Update a ticket
POST https://secure.usedesk.com/uapi/update/ticket
Warning. If you use the server version of Usedesk, you will have a different URL of methods. Check the URL for the API with our team — support@usedesk.com.
The method creates a ticket for an API channel. It accepts the following parameters:
* — mandatory parameters
| Parameter | Value |
| api_token* | Channel API token |
| ticket_id* | Ticket ID |
| subject | Subject of the ticket |
| client_id | Client ID If provided, the request will be bound to the specified client |
| group_id |
Group ID If provided, the request will be bound to the specified group |
| assignee_id |
User ID, who will be assigned to the ticket Usage options:
|
| user_id | ID of the user on whose behalf the changes will be made |
| tag |
Tags String (255 characters) that contains tags, separated with a coma and space |
| priority | Ticket priority String (10 characters) Possible values:
|
| status |
Ticket status Accepts a number that corresponds to the status identifier in the system. Possible values are listed here |
| silent |
A parameter that allows you to specify whether the execution of the current API request should automatically change the ticket status. By default, if a ticket is in the “New” status, any action on it automatically changes the status to “Open” to indicate that it has been processed in some way and is no longer new. To disable the automatic status change, set the silent parameter to true or 1. To restore the default behavior, you can either omit the parameter from the request or set it to false, 0, or a space. |
| type | Ticket type String (10 characters) Possible values:
|
| field_id |
A string that contains the IDs of additional fields You can get ID of additional field in two ways: 1) Open Usedesk and go to Settings → Additional fields. The ID will be shown next to the field name 2) Using API, method "Get a list of additional fields". String (255 characters), separated by semicolons (;). |
| field_value |
A string that contains the values of additional fields, separated by semicolons (;)
Possible values of such fields can be obtained using API, method "Get a list of additional fields". Example of a string with 3 values: "any value;true;93" |
|
lists |
Editing nested lists Array containing parameters:
It is important to follow the structure of nested lists. This means that to change the value of the second level field you must pass the value of the first level field Use an empty value or null to clear the field |
Sample request
{
'ticket_id': '123',
'subject': 'Letter',
'field_id': '10;12;9',
'field_value': 'any value;true;93',
'lists': [
[
{
"id": 1347,
"value": "1"
},
{
"id": 1348,
"value": "22"
}
]
]
}
$data = array(
'api_token'=> 'e1cbe1c1c9d910ef2ae975215644cb53dd555de4',
'client' => "JON",
'email' => "jon@bonjovi.com",
'message' => "Hello World",
'subject' => 'First msg',
'client_id' => 'new_client',
'ticket_id'=>'2154827',
'priority' => 'medium',
'type'=>'task'
'status' => '2',
'subject' => 'POST UPDATE',
'field_id'=> '10;12;9',
'field_value'=> 'any value;true;93'
);
$mch_api = curl_init();
curl_setopt($mch_api, CURLOPT_URL, 'https://secure.usedesk.com/uapi/update/ticket');
curl_setopt($mch_api, CURLOPT_USERAGENT, 'PHP-MCAPI/2.0');
curl_setopt($mch_api, CURLOPT_RETURNTRANSFER, true);
curl_setopt($mch_api, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($mch_api, CURLOPT_TIMEOUT, 10);
curl_setopt($mch_api, CURLOPT_POST, true);
curl_setopt($mch_api, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($mch_api, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($mch_api);
return $result;
If the request is successful, the server will return a message that the request was successfully updated.
{
"status":"success"
}