Versions Compared

Key

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

This API is used to Create the New User in the DNL System.

The structure of API as below:

POST/user/create

HEADER

The request requires you given the Admin Token in headers because the admin has the permission creating the User. 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 User Information that you want to create 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]"
}
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 successful, the server will return code 200 with the message as below:

Code Block
{
  	"object_id": ID of User,
   	"success": true
}

 

If missing body 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 client_id, the server will return code 404 with a message as below:

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

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 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

Code Block
{
   "object_id": 1795,
   "success": true
}

...