Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
This API is used to modify multiple found User. First, you have to put the parameter into API to filter data. Then you put the information need to edit into body of API. All the found Users will be updated with new data.
The structure of API as below:
PATCH | /user/all |
---|
It allows admin to query data by some parameters as below:
Parameters | Description |
---|---|
active | Query data by status of user: Active or not |
create_time_gt | Query data by period time to create User. It is start time |
create_time_lt | Query data by period time to create User. It is end time |
Query data by email User. | |
is_online | Query data by state of the user at the query time: Online or not |
last_login_time_gt | Query data by the period time user logged in to system. It is start time |
last_login_time_lt | Query data by the period time user logged in to system. It is end time |
login_ip | Query data by the IP that user use to login to system. |
name | Query data by name of User. |
role_id | Query data by Role of User. |
user_id | Query data by ID of the User. |
user_id_in | Query by the range of User_ID |
user_type | Query by type of User. |
HEADER
The request requires you given the Admin Token in headers because only admin has the permission editting 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 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": {
"updated": "Total Found and Updated 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 there is no found user, 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 modify the User_ID=1795:
Code Block |
---|
curl \
-H "X-Auth-Token: eyaskjksadkasd9.9123kjsadhkj123jhasdjajsjsdhKS.IH5uHASSJsadnbads980asTHo9dhljM" \
-X PATCH -d "{ \t\"active\": \"true\"}" \
"http://88.99.175.131:8000/v1/user/all?user_type=agent"
|
Response
Code Block |
---|
{
"payload": {
"updated": 91
},
"success": true
} |
...