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

ParameterValue
api_token*Channel API token
ticket_id*Ticket ID
subjectSubject of the ticket
client_idClient 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:

  • group_id is provided and the agent is in this group — the assignment will be within the specified group
  • wrong id — the system will return an error
  • If group_id and assignee_id are provided "null" — the assignee will be "Not assigned"
user_idID 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

priorityTicket priority
String (10 characters)
Possible values:
  • low;
  • medium;
  • urgent;
  • extreme.
By default: medium
status

Ticket status

Accepts a number that corresponds to the status identifier in the system.

Possible values are listed here

typeTicket type
String (10 characters)
Possible values:
  • question;
  • task;
  • problem;
  • incident.
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 (;)

  • For text fields the value should not exceed 255 characters;
  • For checkbox fields – true/false;
  • For list fields – variant ID

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:

  • id
  • value

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"
            }
         ]
     ]
}
        

Example of a PHP query
$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.

Example of a server response
{
    "status":"success"
}