You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

REQUEST

This API is used to authenticate user based on the credential that provided on the body of API. You can call this API without Header.

The user can be Admin, Agent or Client. The structure of API as below:

POST/auth

BODY

You have to put the Authentication Credential into the body of API. The Credential includes the Username and Password of the User.

See example as below:

{
	"password": "string",
	"email_or_name": "string"
}

JSON RESPONSE

There is message return as Json format. It will be return the result of API and the related information as well. See example as below:

{
 	"success": true/false,
  	"payload": { Related Information of the User }
 	"token":"User Token",
   	"cdr_api_token": "cdr_api_token"
}

On this page:

EXAMPLE

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

Request

I will call API to autheticate the admin account:

curl \
-X POST -d "{ \"password\": \"dnladminpass\", \"email_or_name\": \"admin\"}" \
"http://88.99.175.131:8000/v1/auth"
 

Response

{
	"success": true,
   	"payload":    {
      	"cdr_api_token_expiration": "1519567913",
      	"user":       {
         	"login_ip": "183.182.110.28",
         	"first_name": "admin",
         	"fullname": "admin admin",
         	"create_time": "2017-09-08T22:00:00+00:00",
         	"passwd": "$2a$12$.vfsbJIvBvfp5OFmAo8fUO2YeVTFG7rjk9hjZK2BuFmIz/euRq6r6",
         	"report_count": "1 Hour",
         	"is_online": 1,
         	"last_name": "admin",
         	"role_name": "Administrator",
         	"client_id": null,
         	"cdr_api_token": "eHC0k8DDj4nqlIBYpVtSXizPEI8lrOyUe8UMEhZykNmVdx2SSt",
         	"user_id": 1,
         	"all_termination": true,
         	"show_carrier_trunk_drop_only": true,
         	"default_mod": "0",
         	"user_type": "admin",
         	"client_limits":          [
            	{"client_id": 2916},
            	{"client_id": 2917}
         		],
       	"role_id": 0,
      	"last_login_time": "2018-02-24T21:05:36.094423+00:00",
      	"reseller_id": 0,
       	"cdr_expire": "2018-02-25T14:11:53+00:00",
      	"outbound_report": true,
       	"email": "[email protected]",
       	"carrier_name": null,
       	"default_mod2": "0",
       	"active": true,
       	"landing_page": "/routing/rate_table",
       	"create_user_id": null,
       	"card_id": 0,
       	"name": "admin",
       	"client": null,
       	"report_group": true,
       	"last_seen": "2018-02-24T22:11:18.724125+00:00",
       	"report_fields": "111",
       	"is_preload": true,
       	"default_billing_decimal": 0,
       	"avatar_id": 1366,
       	"auth_ip": [],
       	"agent": null
      	},
 	"token": "eyaskjksadkasd9.9123kjsadhkj123jhasdjajsjsdhKS.IH5uHASSJsadnbads980asTHo9dhljM",
  	"cdr_api_token": "eHC0hakjsdhjhjqeweqweq32njkasdjSSt"
   }
}
  • No labels