Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

REQUEST

This API is used to get the information of the Current User.

The structure of API as below:

GET

/user

HEADER

The request requires you given the Token of the user in headers. Based on this Token, the System will detect the user and return the User Information. To get the Token, please refer Authenticate User for more details.

Code Block
{
	"accept": "application/json",
	"X-Auth-Token": "User Token"
}

 

If you call API without header, the system will return the message as below:

Code Block
{
  	"error_type": "unauthenticated_error",
   	"success": false,
   	"error":    {
      	"message": "No header X-Auth-Token present",
      	"code": 110,
      	"reason": "auth_token_not_provided"
   	}
}
Panel

On this page:

Table of Contents

 

JSON RESPONSE

There is message return as JSON format. It will return the result of API and the related information as well.

If you provide the correct token, the server will return code 200 with a message as below:

Code Block
{
  	"success": true,
  	"payload": {The User Information}
}

 

If you provide the wrong token, the server will return code 120 with a message as below:

Code Block
{
   	"error_type": "unauthenticated_error",
   	"success": false,
   	"error":    {
      	"message": "Incorrect token provided",
      	"code": 120,
      	"reason": "incorrect_token_provided"
   	}
}

EXAMPLE

We will know more about the API through the example below:

Request

I will call API to get the information of the admin account:

Code Block
curl \
-H "X-Auth-Token: eyaskjksadkasd9.9123kjsadhkj123jhasdjajsjsdhKS.IH5uHASSJsadnbads980asTHo9dhljM" \
-X GET "http://88.99.175.131:8000/v1/user"

Response

Code Block
{
  	"payload":    {
      	"user_id": 1,
      	"passwd": "$2a$12$.vfsbJIvBvfp5OFmAodsfe4wjk9hjZK2BuFmIz/euRq6r6",
      	"user_type": "admin",
      	"active": true,
      	"carrier_name": null,
      	"default_mod": "0",
      	"reseller_id": 0,
      	"outbound_report": true,
      	"client_limits":       [
         	{"client_id": 2916},
         	{"client_id": 2917},
         	{"client_id": 2951}
      		],
      	"last_name": "admin",
      	"role_id": 0,
      	"last_login_time": "2018-02-26T21:17:06.137172+00:00",
      	"all_termination": true,
      	"report_fields": "111",
      	"client": null,
      	"report_count": "1 Hour",
      	"name": "admin",
      	"first_name": "admin",
      	"cdr_expire": "2018-02-27T16:44:43+00:00",
      	"is_preload": true,
      	"landing_page": "/routing/rate_table",
      	"login_ip": "202.27.171.3",
      	"default_mod2": "0",
      	"avatar_id": 1366,
      	"create_user_id": null,
      	"create_time": "2017-09-08T22:00:00+00:00",
      	"agent": null,
      	"report_group": true,
      	"auth_ip": [],
      	"card_id": 0,
      	"email": "[email protected]",
      	"last_seen": "2018-02-26T21:59:29.187177+00:00",
      	"is_online": 1,
      	"role_name": "Administrator",
      	"client_id": null,
      	"fullname": "admin admin",
      	"cdr_api_token": "14zN3jPQPUJnGNYTZ8MVWDx4DvrNjcWlhV6kCVAcxSPEpvhP31",
      	"show_carrier_trunk_drop_only": true
   		},
  	"success": true
}