Example of using the simplified REST API to retrieve and update work notes


The following example demonstrates how you can use the BMC Helix ITSM simplified API to retrieve or add a work note.

You can provide the following parameters:

Parameter

Type

Location

Description

Type

String

Path (mandatory)

Specify any of the following ticket types:

  • Incident
  • Problem
  • Change

ID

String

Path (Mandatory)

The ID of the ticket. For example: INC000000000102.

startIndex

Integer

Query (Optional)

This is an optional parameter to specify the start index.

pageSize

Integer

Query (Optional)

This is an optional parameter to specify the page size for the result.

To retrieve the details of a work note from a ticket

cURL example

curl -X 'GET' \
 'https://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/v2/worknote/incident/INC000000000102' \
 -H 'accept: application/json'

Request URL

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

Response body

"{
    ""status"": ""Success"",
    ""recordCount"": 1,
    ""details"": [
        {
            ""note"": ""Adding image"",
            ""submitter"": ""Allen"",
            ""attachments"": [
                {
                    ""fileName"": ""icn_rewards.png"",
                    ""fileSize"": 1141,
                    ""downloadUrl"": ""api/com.bmc.dsm.itsm.itsm-rest-api/attachment/download/HPD:WorkLog/1000000351/AGGAA5V0FMHNBAR406EMR406EMLQ1S"",
                    ""id"": ""AGGAA5V0FMHNBAR406EMR406EMLQ1S"",
                    ""attachmentReference"": {
                        ""dataSourceId"": ""AGGAA5V0FMHNBAR406EMR406EMLQ1S"",
                        ""attachmentFieldId"": ""1000000351"",
                        ""dataSource"": ""HPD:WorkLog""
                    }
                }
            ],
            ""attachmentCount"": 1,
            ""id"": ""AGGAA5V0FMHNBAR406EMR406EMLQ1S"",
            ""type"": ""8000"",
            ""activityType"": ""user"",
            ""viewAccess"": false,
            ""createDate"": ""2022-06-30T11:33:58.000Z""
        }
    ]
}"

To add a work note to a ticket

cURL example

curl --location --request POST 'http://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/v2/worknote/incident/INCI000000000010' \
--header 'X-Requested-By: XMLHttpRequest' \
--form 'file=@"/Users/Allen/Logs/LogFile.txt"' \
--form 'note="This is sample note with attachment"' \
--form 'infoType="4000"' \
--form 'access="true"'


Request URL

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

Response body

{
   "status": "Success",
   "details": {
       "id": "AGGAA5V0FMHNBAR492L4R492L4WXLG"
   }
}

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 problem investigation

  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 the details of a work note from a ticket

    GET

    https://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/v2/worknote/<type>/<ID>?startIndex=<StartIndex>&pageSize=<pageSize>

    To add a work note to a ticket

    POST

    https://<Innovation Suite server URL>/api/com.bmc.dsm.itsm.itsm-rest-api/v2/worknote/<type>/<ID>

    The following are the parameters:

    Parameter

    Type

    Description

    Type

    String

    Specify any of the following ticket types:

    • Incident
    • Problem
    • Change

    ID

    String

    The ID of the ticket. For example: INC000000000102.

    startIndex

    Integer

    This is an optional parameter to specify the start index.

    pageSize

    Integer

    This is an optional parameter to specify the page size for the result.

  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. Perform the following steps only if you want to add a work note to a ticket:
    1. On the Body tab, select form-data.
    2. You can use files to provide additional information for the problem investigation.
      Work note API ss.png
  6. 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*