Set initial Priority value with cURL


#1

We have employees who are allowed to create tickets but are not given access to the RT UI. They use a form to create new tickets or update existing ones.

This is done via cURL. We send parameters and values in JSON format to the REST interface.

Has anyone succeeded in setting the Priority field (in The Basics) to an integer value sent via JSON and cURL?

It would look something like this:
.
.
.
$jsonstr = ‘{“requestor”: "’ . $requestor . ‘", “subject”: "’ . $subject . ‘", “content”: "’ . $content . ‘", “queue”: "’ . $queue . ‘", “name”: "’ . $name . ‘", “phone”: "’ . $phone . ‘", “email”: "’ . $email . ‘", “service_provider”: "’ . $service_provider . ‘", “service_type”: "’ . $service_type . ‘", “service_address”: "’ . $service_address . ‘", “account_number”: "’ . $account_number . ‘", “priority”: "’ . $priority . ‘"}’;
$params = [ ‘data’ => $jsonstr ];
$ch = curl_init($service_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, ‘POST’);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
$response = curl_exec($ch);
.
.
.
My guess is that the parameter name in this part of the JSON string: “priority”: “’ . $priority . '” isn’t correct. The variable $priority always has an integer value. currently, it’s only possible values are 0 and 3.

Thanks in advance!