Versions Compared

Key

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

This API is used to get the User Information based on User ID. You have to put the User_ID that you want to get into the API as the parameter. Based on this ID, the DNL System will detect the User then return the User Information.

The structure of API as below:

GET

/user/{user_id}

HEADER

The request requires you given the Token of the Admin in because onlyadminhasthempermission to see User's Information. To get the Token, please refer Authenticate User for more details.

Code Block
{
	"accept": "application/json",
	"X-Auth-Token": "Admin 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"
   	}
}

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 and User_ID, 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"
   	}
}

 

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

Code Block
{
   	"error_type": "Object not found",
  	"success": false
}
Panel

On this page:

Table of Contents

EXAMPLE

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

Request

I will call API to get the information of the User_ID: 1795:

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

Response

Code Block
{
   	"payload":    {
      	"user_id": 1795,
      	"passwd": "$2b$12$Z4Rs3ZKUzJwnoqaRS472D.UF5ZBMdAmAWd8umjZHMud3ulAh/GSgi",
      	"user_type": "agent",
      	"active": true,
      	"carrier_name": null,
      	"default_mod": "",
      	"reseller_id": null,
      	"outbound_report": true,
      	"client_limits": [],
      	"last_name": null,
      	"role_id": null,
      	"last_login_time": null,
      	"all_termination": true,
      	"report_fields": "string",
      	"client": null,
      	"report_count": "1 Hour",
      	"name": "dnhai",
      	"first_name": "string",
      	"cdr_expire": null,
      	"is_preload": true,
      	"landing_page": "string",
      	"login_ip": null,
      	"default_mod2": "string",
      	"avatar_id": null,
      	"create_user_id": 1,
      	"create_time": "2018-02-26T22:39:43.438420+00:00",
      	"agent": null,
      	"report_group": true,
      	"auth_ip": [],
      	"default_billing_decimal": 4,
      	"card_id": 0,
      	"email": "[email protected]",
      	"last_seen": null,
      	"is_online": 2,
      	"role_name": "",
      	"client_id": null,
      	"fullname": null,
      	"cdr_api_token": null,
     	"show_carrier_trunk_drop_only": true
   		},
   	"success": true
}