In the REST 1.0 interface, I can Get a list of all the Ticket IDs for this Queue using:
https://{SERVER}/rt/REST/1.0/search/ticket?query=Queue=’$queue’
I need to restrict this further, to tickets created after a certain date by checking against the Create field. Nothing that I’ve seen in the forum or in the documentation covers this.
We have the REST 2.0 module installed, so we’re not limited to only what REST 1.0 can do. It’s crucial to limit the output as described because we’ll run a function against each ticketID to determine if it meets certain criteria and if so, extract certain data from it.
This must be done in the context of a script (we write ours in PHP) so that the search can be done nightly via a cron job.
The current PHP function looks like this:
function searchQueue($token, $queue, $tsStart) {
$serviceURL = “https://{SERVER}/rt/REST/1.0/search/ticket?query=Queue=’$queue’”;
$ch = curl_init($serviceURL);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(“Authorization: token $token”));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$response = preg_replace(’/RT/4.4.2 200 Ok\n\n/’, ‘’, $response);
$response = preg_replace(’/[:\s].*.[\n]/’, ‘,’ , $response);
$list = explode(’,’,$response);
return ($list);
}
Thanks in advance!