This documentation supports the 21.3 version of BMC Helix ITSM.To view an earlier version, select the version from the Product version menu.

Example of using the simplified REST API to search for a ticket


The following example demonstrates how you can use the BMC Helix ITSM simplified API to search for an incident, change, or problem ticket.


cURL example

curl -X 'POST' \ 'https://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/ticket/search?filter=MyGroup' \ -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/ticket/search?filter=MyGroup

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

  1. Open the Postman REST Client.
  2. Set the request URL as:
    https://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/ticket/search?filter=<search filter>
  3. Select the operation as POST.
  4. Click Headers.
  5. Enter the following data as key value pairs in the header:

    Key

    Value

    X-Requested-By

    XMLHttpRequest

    Content-Type

    application/json

  6. Select raw.
  7. From the list, select JSON.
  8. Enter the JSON input for searching a ticket.
    For example:

    {
      "limit":10,
      "offset":10,
      "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 }"
      }
    }

    You can customize the search criteria by using either AND or OR in bindingExpression.

  9. Click Send.
    The results are displayed on the response panel.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*