Get a list of additional fields
POST https://secure.usedesk.com/uapi/ticket/fields
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 returns all additional fields of company.
* — required fields
Parameter | Value |
api_token* | Channel API token |
PHP request example
$data = array( 'api_token'=> 'e1cbe1c1c9d910ef2ae975215644cb53dd555de4', ); $mch_api = curl_init(); // initialize cURL connection curl_setopt($mch_api, CURLOPT_URL, 'https://secure.usedesk.com/uapi/ticket/fields'); 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;
Example of a response from server
[ { "custom_field": { "id": "1", "company_id": "153561", "ticket_field_type_id": "2", // 1 - text, 2 - list, 3 - checkbox "name": "Difficulty", "value": null, "required": "1", // If the field is obligatory, you cannot leave a response to the request without filling in the field. "add_tag": "1", // Adds a tag in the format of : when a field value is added to the request. "add_filter": "1", // The field is added to the page filter \tickets "sort": "0", // The sorting order on the field list page. The less the value is, the upper a field is displayed. "active": "1", "hidden": "0", // 0 - the field is displayed on the page of request in the menu for editing, 1 - not displayed. "api": "0", // 0 - the field is editable, 1 - non-editable, i.e. you can edit the field via api only "deleted": "0" }, // If the field type is 2 (list), a list of field values is returned in addition. "field_options": [ { "id": "1", "ticket_field_id": "1", "value": "Difficult" }, { "id": "2", "ticket_field_id": "1", "value": "Very difficult" }, { "id": "3", "ticket_field_id": "1", "value": "Unreal" } ] } ]