Rest API

Auth Rest API

Authentication requests are responsible for a user account. It provides creating an account, changing data about it, and access it.

In this article you can read about all these requests:

  1. auth/signup
  2. auth/login with password & username
  3. auth/login with auth_key
  4. auth/updateuser
  5. auth/logout

auth/signup

Request for creating a new user account.

Request

Request Method Content Type Request URL
POST Form Data https://gudhub.com/GudHub/auth/signup

It contains user object with standard registration information. The object "user" needs certain data to be created:

Property Type Description
fullname string contains full user name
password string contains user password
username string contains user email

Example:

   user: {
      "fullname" : "Jon Jerry",
      "password" : "mypassword",
      "username" : "jon@gudhub.com"
   }

Response

As a result you will get an object with all user data.

{
   "User_id" : 149,
   "accesstoken" : "hkpbqelu_jt-rxatjfvulzjgfj-qizjhunonbdto",
   "username" : "jon@gudhub.com",
   "fullname" : "Jon Jerry",
   "auth_key" : "jgjgGJHGgHGJGHJBGHJGG/DKJSL934394",
   "expirydate" : 1497912166008,
   "app_init" : 3444
}

Status Code

Name Description
200 Ok user is registered
400 Bad Request incorrect request syntax
600 user with such name does not exist

auth/login with password & username

There are two types of login requests. The first one is with the help of password and username. It contains password and username.

Request

Request Method Content Type Request URL
POST Form Data https://gudhub.com/GudHub/auth/login

It contains password and username.

Property Type Description
password string user account password
login string user account login

Example:

   password : mypassword
   username : jon@gudhub.com

Response

In return will be an array of existing applications.

apps_list:[{
   "user_id" : 149,
   "accesstoken" : "bd.ayazr-m.glypihesgsxjyzba.eskjvtrbatrzw",
   "username" : "jon@gudhub.com",
   "fullname" : "Jon Jerry",
   "auth_key" : "JXNCKJZNCKZKJCjkjbskjacks394934",
   "expirydate" : 1497912390112,
   "app_init" : 3444
}]

Status Code

Name Description
200 Ok success
401 Unauthorized wrong login or password
711 incorrect login
712 incorect password

auth/login with auth_key

Request for login into an existing account.

Request

Request Method Content Type Request URL
POST Form Data https://gudhub.com/GudHub/auth/login

It contains the auth key.

Property Type Description
auth_key string personal authentication key

Example:

   auth_key:
   hIHIHIUioihsbdospklmzxnHsdlkiojojojisjdnjvkbiuoajdnwjnufosfjji0045456/==

Response

As well as the first login request, this one will returns an array of existing applications.

{ 
   "user_id" : 116,
   "accesstoken" : "bccfcpmkkytbchwrgbfkq._roozssrs_dpjokyjyv_",
   "username" : "webmaster@atlasiko.com",
   "fullname" : "Web Master",
   "auth_key" : "jgjJGJGhjvHGCHghJGIuGgchgCa909/jhiuahxiu==",
    "expirydate" : 1497974317507
}

Status Code

Name Description
000 Unauthorized wrong auth_key
200 Ok success

auth/updateuser

Request for updating data of the existing account.

Request

Request Method Content Type Request URL
POST Form Data https://gudhub.com/GudHub/auth/updateuser

It contains token and user object.

Property Type Description
token string using for getting access
user object created user

Example:

   Token: prijmtwlezsxxyromyzbx_eptm.etnkhaewwp-_y

   user:{
      "user_id" : 149,
      "fullname" : "Jon Jerry",
      "username" : "jon@gudhub.com",
      "app_init" : 3444
   }

Response

In result will be updated user data.

{
   "user_id" : 149,
   "username" : "jon@gudhub.com",
   "fullname" : "Jon Jerry",
   "expirydate" : 0,
   "app_init" : 3445
}

Status Code

Name Description
000 Unupdate wrong data (format or number of symbols)
200 Ok success

auth/logout

Request for signing out of the account.

Request

Request Method Content Type Request URL
POST Form Data https://gudhub.com/GudHub/auth/logout

It contains only token.

Property Type Description
token string using for getting access

Example:

   token:
   hkpbqelu_jt-rxatjfvulzjgfj-qizjhunonbdto

Response

In reply will be a success message.

Logout OK for token: 
hkpbqelu_jt-rxatjfvulzjgfj-qizjhunonbdto

Status Code

Name Description
200 logout is success