Versions Compared

Key

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

This API is used to modify the User. You have to put the User_ID into API as the parameter. Based on this ID, DNL System will detect the User and modify them.

The structure of API as below:

PATCH

/user/{user_id}

HEADER

The request requires you given the Admin Token in headers because onlyadminhasthe permission edittingtheUser. 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"
   	}
}

BODY

You have to put the New User Information that you want to edit to into body as below:

Code Block
{
  	"passwd": "string",
  	"user_type": "admin - agent - client",
  	"client": {
    	"is_panel_ratetable": true,
    	"is_panel_invoices": true,
    	"is_panel_products": true,
    	"is_panel_paymenthistory": true,
    	"carrier_name": "string",
    	"is_panel_trunks": true,
    	"is_panel_balance": true,
    	"is_panel_onlinepayment": true,
    	"is_panel_cid_blocking": true,
    	"is_panel_sippacket": true,
    	"is_panelaccess": true,
    	"is_panel_accountsummary": true,
    	"is_panel_summaryreport": true,
    	"is_panel_cdrslist": true
  		},
  	"default_mod": "string",
  	"reseller_id": 0,
  	"outbound_report": true,
  	"client_limits": [
    	{
      	"client_id": 0
    	}
  		],
  	"last_name": "string",
  	"role_id": 0,
  	"all_termination": true,
  	"auth_ip": [
   	 	{
      	"ip": "string"
    	}
  		],
  	"landing_page": "string",
  	"first_name": "string",
  	"active": true,
  	"client_id": 0,
  	"default_mod2": "string",
  	"avatar_id": 0,
  	"report_group": true,
  	"card_id": 0,
  	"show_carrier_trunk_drop_only": true,
  	"name": "string",
  	"report_fields": "string",
  	"email": "[email protected]"
}

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:

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

 

If missingbody or missing any fields, It will return code 400 and message as below:

Code Block
{
   "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:

Code Block
{
 	"error_type": "unauthenticated_error",
  	"success": false,
  	"error": {
    	"message": "No header X-Auth-Token present",
    	"code": 110,
    	"reason": "auth_token_not_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 error",
  "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 create new Agent:

Code Block
curl \
-H "X-Auth-Token: eyaskjksadkasd9.9123kjsadhkj123jhasdjajsjsdhKS.IH5uHASSJsadnbads980asTHo9dhljM" \
-X PATCH -d "{ \t\"email\": \"[email protected]\"}" \
"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
}

...