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 a change request


The following example demonstrates how you can use the BMC Helix ITSM simplified API to perform the following operations on a change request:

  • Retrieve change request details based on search criteria
  • Retrieve change request details based on the request ID
  • Update status of a change request 


To retrieve change request details based on search criteria

cURL example

curl -X 'POST' \
 'https://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/v2/change/search?filter=My Group Need Attention Tickets&optimize=Y  
  -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/change/search?filter=My Group Need Attention Tickets&optimize=Y    

Request body

"{
    ""limit"": 2,
    ""offset"": 0,
    ""criteria"": {
        ""bindingExpression"": ""AND"",
        ""conditions"": [
            {
                ""fieldName"": ""status"",
                ""operation"": ""neq"",
                ""fieldValue"": ""10""
            },
            {
                ""fieldName"": ""status"",
                ""operation"": ""neq"",
                ""fieldValue"": ""11""
            },
            {
                ""fieldName"": ""status"",
                ""operation"": ""neq"",
                ""fieldValue"": ""12""
            },
            {
                ""fieldName"": ""status"",
                ""operation"": ""neq"",
                ""fieldValue"": ""13""
            }
        ]
    }
}"

To retrieve change request details based on the request ID

cURL example

curl --location --request GET 'https://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/v2/change/CRQ000000000501'

Request URL

http://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/v2/change/CRQ000000000501

To update the status of a change request

cURL example

curl -X 'PATCH' \
 'https://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/v2/change/CRQ000000000001' \
 -H 'accept: application/json' \
 -H 'Content-Type: application/json' \
 -d '{
  "coordinator": {
    "loginId": "PetramcoCMManager"
  },
  "coordinatorGroupId": "SGP000000000213",
  "coordinatorGroup": "Petramco Support Group1",
  "coordinatorGroupOrganization": "Petramco Support Org1",
  "coordinatorGroupCompany": "Petramco"
}  '

Request URL

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

Request body

{
 "coordinator": {
   "loginId": "PetramcoCMManager"
 },
 "coordinatorGroupId": "SGP000000000213",
 "coordinatorGroup": "Petramco Support Group1",
 "coordinatorGroupOrganization": "Petramco Support Org1",
 "coordinatorGroupCompany": "Petramco"
}  

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 a change request

  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 change request details based on search criteria

    POST

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

    To retrieve change request details based on the request ID

    GET

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

    To update the status of a change request 

    PATCH

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

  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 retrieve change request details based on search criteria
    "{
        ""limit"": 2,
        ""offset"": 0,
        ""criteria"": {
            ""bindingExpression"": ""AND"",
            ""conditions"": [
                {
                    ""fieldName"": ""status"",
                    ""operation"": ""neq"",
                    ""fieldValue"": ""10""
                },
                {
                    ""fieldName"": ""status"",
                    ""operation"": ""neq"",
                    ""fieldValue"": ""11""
                },
                {
                    ""fieldName"": ""status"",
                    ""operation"": ""neq"",
                    ""fieldValue"": ""12""
                },
                {
                    ""fieldName"": ""status"",
                    ""operation"": ""neq"",
                    ""fieldValue"": ""13""
                }
            ]
        }
    }"
    To update the status of a change request
    "{
        ""coordinator"": {
            ""loginId"": ""PetramcoCMManager""
        },
        ""coordinatorGroupId"": ""SGP000000000213"",
        ""coordinatorGroup"": ""Petramco Support Group1"",
        ""coordinatorGroupOrganization"": ""Petramco Support Org1"",
        ""coordinatorGroupCompany"": ""Petramco""
    }"
  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*