Additional fields

Warning

If you use the on-premise UseDesk version on your own server, then the URL of your methods will be different. Specify the URL to work with API by contacting our support team - support@usedesk.ru

Get a list of additional fields

url: https://api.usedesk.ru/ticket/fields

The method returns all additional fields of company.

PHP request example
$data = array(
	'api_token'=> 'e1cbe1c1c9d910ef2ae975215644cb53dd555de4',
);
$mch_api = curl_init(); // initialize cURL connection

curl_setopt($mch_api, CURLOPT_URL, 'https://api.usedesk.ru/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"
			}
		]
	}
]

Editing nested lists

url: https://api.usedesk.ru/update/connectedList Deprecated (version 1.0): Not recommended. Work with nested lists is carried out in ticket update method https://api.usedesk.ru/update/ticket.

application/json

The method allows to change the values of nested lists at additional fields of the ticket.

Parameter value
api_token Token
ticket_idTicket’s id
listsArray of nested lists. Each list is an array with list values. Sequence is not important.
PHP request example
$data = [
	"api_token"=> "e1cbe1c1c9d910ef2ae975215644cb53dd555de4",
	"ticket_id"=>1231231,
	"lists"=> [
		[
			["id"=>"61","value"=>"Test"],
			["id"=>"62","value"=>"Test1"],
			["id"=>"63","value"=>"Test2"]
		]
	]
];
$mch_api = curl_init();

curl_setopt($mch_api, CURLOPT_URL, 'https://api.usedesk.ru/update/connectedList');
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
{
	"status":"ok",
	"code":200
}