Example of using the simplified REST API to search for a ticket
cURL example
curl -X 'POST' \
'https://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/v2/ticket/search?filter=my%20group' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"limit": 10,
"offset": 10,
"sortBy": [{ "field" : "priority", "order": "desc"}],
"fields": "['\''id'\'','\''status'\'']",
"criteria": {
"bindingExpression": "AND",
"conditions": "{\r\n \"fieldName\": \"status\",\r\n \"operation\": \"eq\",\r\n \"fieldValue\": \"27000\"\r\n },\r\n {\r\n \"fieldName\": \"assignee\",\r\n \"operation\": \"eq\",\r\n \"fieldValue\": \"Allen Allbrook\"\r\n }"
}
}'
Request URL
https://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/v2/ticket/search?filter=my%20group
Request body
"limit": 10,
"offset": 10,
"sortBy": [{ "field" : "priority", "order": "desc"}],
"fields": "['\''id'\'','\''status'\'']",
"criteria": {
"bindingExpression": "AND",
"conditions": "{\r\n \"fieldName\": \"status\",\r\n \"operation\": \"eq\",\r\n \"fieldValue\": \"27000\"\r\n },\r\n {\r\n \"fieldName\": \"assignee\",\r\n \"operation\": \"eq\",\r\n \"fieldValue\": \"Allen Allbrook\"\r\n }"
}
}
The following example demonstrate how to perform the operation by using Postman client.
Before you begin
Make sure that you have a valid authentication token. For more information, see Access-and-authentication-for-the-simplified-REST-API.
To search for a ticket by using the simplified REST API in the Postman client
- Open the Postman REST Client.
- Set the request URL as:
https://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/v2/ticket/search?filter=<search filter> - Select the operation as POST.
- Click Headers.
Enter the following data as key value pairs in the header:
Key
Value
X-Requested-By
XMLHttpRequest
Content-Type
application/json
- Select raw.
- From the list, select JSON.
Enter the JSON input for searching a ticket.
For example:{
"limit": 10,
"offset": 0,
"sortBy": [{ "field" : "status", "order": "desc"}, { "field" : "priority", "order": "desc"}]
"fields": ["id", "status"],
"criteria" :
{
"bindingExpression": "OR",
"conditions" :
[
{
"fieldName": "status",
"operation": "eq",
"fieldValue": "27000"
},
{
"fieldName": "assignee",
"operation": "eq",
"fieldValue": "Allen Allbrook"
}
]
}
}You can customize the search criteria by using either AND or OR in bindingExpression.
- Click Send.
The results are displayed on the response panel.