JSON RESPONSE
There is message return as JSON format. It will return the result of API and the related information as well.
If successful, the server will return code 200 with the message as below:
{ "object_id": ID of User, "success": true }
If missing body or missing any fields, It will return code 400 and message as below:
{ "error_type": "validation_error", "success": false, "errors": [ { "field_name": ["Missing data for required field."] }] }
If the Token wrong, it will return code 401 with a message as below:
{ "error_type": "unauthenticated_error", "success": false, "error": { "message": "No header X-Auth-Token present", "code": 110, "reason": "auth_token_not_provided" } }
EXAMPLE
We will know more about the API through the example below:
Request
I will call API to create new Agent:
curl \ -H "X-Auth-Token: eyaskjksadkasd9.9123kjsadhkj123jhasdjajsjsdhKS.IH5uHASSJsadnbads980asTHo9dhljM" \ -X POST -d "{ \t\"passwd\": \"12345678\", \t \"user_type\": \"agent\",\t\"landing_page\": \"string\", \t\"first_name\": \"string\", \t\"active\": true, \t\"default_mod2\": \"string\", \t\"report_group\": true, \t\"card_id\": 0, \t\"show_carrier_trunk_drop_only\": true, \t\"name\": \"dnhai\", \t\"report_fields\": \"string\", \t\"email\": \"[email protected]\"}" \ "http://88.99.175.131:8000/v1/auth/as_client"
Response
{ "object_id": 1795, "success": true }