Single ticket

POST https://api.usedesk.ru/ticket

The method returns ticket information by its id. It gets one argument: ticket id.

* — required fields

Parameter Value
api_token* Channel API token
ticket_id* Ticket ID
accessible_for_agent_id

Filtering by Agent ID

Considers the rights of the employee.

The server returns the variable rights:

  • write — if there is access to work with tickets in the current channel;
  • read — if there is access to view the tickets in the current channel.
properties

Time until SLA

"properties": ["sla"]

  • first_reply — first response SLA;
  • next_reply — next response SLA;
  • close — execution time SLA.

If SLAs are not specified in the ticket, SLAs are not returned in the response

Request example
$data = array(
        'api_token'=> 'e1cbe1c1c9d910ef2ae975215644cb53dd555de4',
        'accessible_for_agent_id'=>'6339',
        'ticket_id'=>'2261648',
);
$mch_api = curl_init(); 
curl_setopt($mch_api, CURLOPT_URL, 'https://api.usedesk.ru/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;
        

The server returns a ticket, all comments, tags and a history of changes.


Example of a response from server
{
    "ticket":{
        "id":"2265179",
        "status_id":"1",
        "subject":"additional fields",
        "client_id":"261702",
        "assignee_id":"2",
        "group":"0",
        "last_updated_at":"2017-03-01 14:30:49",
        "email":"0",
        "published_at":"2017-03-01 14:30:49",
        "company_id":"153561"
    },
    "comments":[
        {
            "id":"2658287",
            "message":"additional fields",
            "from":"client",
            "user_id":null,
            "client_id":"261702",
            "ticket_id":"2265179",
            "is_first":"0",
            "delivered":"0",
            "readed":"0",
            "published_at":"2017-03-01 14:30:49"
        }
    ],
    "changes":[
        {
            "id":"213671",
            "trigger_id":"1260",
            "user_id":null,
            "ticket_id":"2265179",
            "data":[
                {
                    "target":"assignee",
                    "value":"2"
                }
            ],
            "changed_at":"2017-03-01 14:30:49",
            "old_status":"0",
            "new_status":"0",
            "company_id":"153561"
        },
        {
            "id":"213669",
            "trigger_id":null,
            "user_id":null,
            "ticket_id":"2265179",
            "data":[
            ],
            "changed_at":"2017-03-01 14:30:49",
            "old_status":"0",
            "new_status":"1",
            "company_id":"153561"
        }
    ],
    "tags":[
        "Bycicle Number":"134",
        "Veggies":"tomato"
    ],
    "custom_fields":[
        {
            "id":"143",
            "ticket_id":"2265179",
            "ticket_field_id":"10",
            "value":"134"
        },
        {
            "id":"145",
            "ticket_id":"2265179",
            "ticket_field_id":"7",
            "value":"1"
        },
        {
            "id":"147",
            "ticket_id":"2265179",
            "ticket_field_id":"9",
            "value":"9"
 }
    ]
            "rights": "write",
}
        

Server response parameters

ParameterDescription
id
Ticket ID
status_idID of ticket status
priorityTicket priority
typeTicket type
subjectTicket subject
client_idClient ID
assignee_idAssignee ID
groupGroup ID
last_updated_atDate and time of the last ticket update
UTC+0 time zone
emailEmail that the request came from
Specified if the request was created in the email channel
published_atTicket creation date and time
UTC+0 time zone
company_idCompany ID
channel_idChannel ID
additional_idAdditional ID
Service field
client_nameClient name
active_slaArray of current ticket SLAs
  • type:
    • close — execution SLA;
    • first_reply — first response SLA;
  • date — SLA expiration date and time
commentsTicket comments array

ParameterDescription
idComment ID
messageComment text
fromWho wrote the comment
  • user;
  • client
typeTicket type
user_idID of the user who left the comment
client_idID of the client who left the comment
client_nameClient name
ticket_idTicket ID
is_firstFlag indicating the first comment in the ticket
deliveredFlag indicating comment delivery
readedFlag indicating that the comment has been read
published_atDate and time of comment creation
UTC+0 time zone
fileFile ID
filesArray of attached files
  • name — file name;
  • type — file type;
  • file — download link
bccArray of hidden copy (BCC) addresses
ccArray of open copy (CC) addresses
changesArray of ticket changes

ParameterDescription
idChange ID
trigger_idThe ID of the trigger that caused the request change
user_idThe ID of the user who caused the request to change
ticket_idTicket ID
dataContents of the change
  • target — change target
  • old_value — old value
  • value — new value
changed_atDate and time of change
UTC+0 time zone
old_statusTicket status ID before change
new_statusTicket status ID after change
company_idCompany ID
tagsTicket tags array
custom_fieldsArray with values of additional fields of the ticket
  • ticket_field_id — additional field ID;
  • ticket_id — ticket ID;
  • value — additional field value.
rightsThe rights of the specified employee
  • write — if there is access to work with the request in the current channel;
  • read — if there is access to view the request in the current channel.