This documentation supports the 23.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 and update an incident


The following example demonstrates how you can use the BMC Helix ITSM simplified API to perform the following operations on an incident:

  • Retrieve incident details based on search criteria
  • Retrieve incident details based on the incident ID
  • Update the details of an incident 

To retrieve incident details based on search criteria

cURL example

curl -X 'POST' \
 'https://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/v2/incident/search?filter=My%20Group%20Tickets' \
 -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/incident/search?filter=My%20Group%20Tickets

Request body

{
 "limit": 2,
 "offset": 0,
 "criteria": {
   "bindingExpression": "OR",
   "conditions": [
     {
       "fieldName": "status",
       "operation": "eq",
       "fieldValue": "27000"
     },
     {
       "fieldName": "assignee",
       "operation": "eq",
       "fieldValue": "Allen Allbrook"
     }
    ]
 }
}

To retrieve incident details based on the incident ID

cURL example

curl --location --request PATCH 'http://clm-pun-v7w4l2:8008/api/com.bmc.dsm.itsm.itsm-rest-api/incident/INC000000000113' \
-H 'X-Requested-By: XMLHttpRequest' \
-H 'Content-Type: application/json' \
-d '{
    "assignee": {
        "loginId": "Allen"
    },
    "assigneeGroupId": "SGP000000000010",
    "assigneeGroup": "Frontoffice Support",
    "assigneeSupportCompany": "Calbro Services",
    "assigneeSupportOrganization": "IT Support"
}'

Request URL

https://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/v2/incident/INC000000000102

To update the details of an incident

cURL example

curl -X 'PATCH' \
 'https://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/v2/incident/INC000000000102' \
 -H 'accept: application/json' \
 -H 'Content-Type: application/json' \
 -d '{
  "additionalProp1": {},
  "additionalProp2": {},
  "additionalProp3": {}
}'

Request URL

https://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/v2/incident/INC000000000102

Request body

{
 "fields": [
   "id",
   "assigneeGroupId",
   "assignee",
   "assigneeGroup",
   "assigneeSupportOrganization",
   "assigneeSupportCompany"
  ],
 "assignee": {
   "loginId": "Allen"
 },
 "assigneeGroupId": "SGP000000000010",
 "assigneeGroup": "Frontoffice Support",
 "assigneeSupportCompany": "Calbro Services",
 "assigneeSupportOrganization": "IT Support"
}

The following example demonstrate how to perform the operations 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 and update an incident

  1. Open the Postman - REST Client.
  2. Depending on your goal, set the request URL and method as any of the following:

    Goal

    Method

    Sample URL

    To retrieve incident details based on search criteria

    POST

    https://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/v2/incident/search?filter=<search filter>

    In this URL, the filter query parameter can have the following three values:

    • My Group Tickets
    • My Group Open Tickets
    • My Group Need Attention Tickets

    To retrieve incident details based on the incident ID

    GET

    https://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/v2/incident/INC000000000102

    To update the details of an incident 

    PATCH

    https://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/v2/incident/INC000000000102

  3. Click Headers.
  4. Enter the following data as key value pairs in the header:

    Key

    Value

    X-Requested-By

    XMLHttpRequest

    Content-Type

    application/json

  5. On the Body tab, select raw.
  6. From the list, select JSON.
  7. Enter the JSON.
    For example

    To search for an incident based on search criteria
    {
     "limit": 2,
     "offset": 0,
     "criteria": {
       "bindingExpression": "OR",
       "conditions": [
         {
           "fieldName": "status",
           "operation": "eq",
           "fieldValue": "27000"
         },
         {
           "fieldName": "assignee",
           "operation": "eq",
           "fieldValue": "Allen Allbrook"
         }
        ]
     }
    }
    To update an incident based on the incident ID
    {
     "fields": [
       "id",
       "assigneeGroupId",
       "assignee",
       "assigneeGroup",
       "assigneeSupportOrganization",
       "assigneeSupportCompany"
      ],
     "assignee": {
       "loginId": "Allen"
     },
     "assigneeGroupId": "SGP000000000010",
     "assigneeGroup": "Frontoffice Support",
     "assigneeSupportCompany": "Calbro Services",
     "assigneeSupportOrganization": "IT Support"
    }
  8. 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*