Single ticket

POST https://secure.usedesk.com/uapi/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://secure.usedesk.com/uapi/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

Parameter Description
id
Ticket ID
status_id ID of ticket status
priority Ticket priority
type Ticket type
subject Ticket subject
client_id Client ID
assignee_id Assignee ID
group Group ID
last_updated_at Date and time of the last ticket update
UTC+0 time zone
email Email that the request came from
Specified if the request was created in the email channel
published_at Ticket creation date and time
UTC+0 time zone
company_id Company ID
channel_id Channel ID
additional_id Additional ID
Service field
client_name Client name
active_sla Array of current ticket SLAs
  • type:
    • close — execution SLA;
    • first_reply — first response SLA;
  • date — SLA expiration date and time
comments Ticket comments array

Parameter Description
id Comment ID
message Comment text
from Who wrote the comment
  • user;
  • client
type Ticket type
user_id ID of the user who left the comment
client_id ID of the client who left the comment
client_name Client name
ticket_id Ticket ID
is_first Flag indicating the first comment in the ticket
delivered Flag indicating comment delivery
readed Flag indicating that the comment has been read
published_at Date and time of comment creation
UTC+0 time zone
file File ID
files Array of attached files
  • name — file name;
  • type — file type;
  • file — download link
bcc Array of hidden copy (BCC) addresses
cc Array of open copy (CC) addresses
changes Array of ticket changes

Parameter Description
id Change ID
trigger_id The ID of the trigger that caused the request change
user_id The ID of the user who caused the request to change
ticket_id Ticket ID
data Contents of the change
  • target — change target
  • old_value — old value
  • value — new value
changed_at Date and time of change
UTC+0 time zone
old_status Ticket status ID before change
new_status Ticket status ID after change
company_id Company ID
tags Ticket tags array
custom_fields Array with values of additional fields of the ticket
  • ticket_field_id — additional field ID;
  • ticket_id — ticket ID;
  • value — additional field value.
rights The 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.