Creating a Request or Incident via REST API using JSON for SDM

book

Article ID: 212880

calendar_today

Updated On:

Products

CA Service Management - Service Desk Manager CA Service Desk Manager

Issue/Introduction

How to create a Request or Incident via REST API using JSON for SDM?

Environment

Release : 17.2

Component : REST API

Resolution

1. Obtain Access Key. Refer to:

How to Use the Secret Key Authentication with REST API?

Code snippet example:

curl --location --request POST 'http://sdmservername:8050/caisd-rest/rest_access' \
--header 'Authorization: Basic U2VydmljZURlc2s6UHJpbWExMjNWZXJh' \
--header 'Content-Type: application/xml' \
--data-raw '<rest_access/>'

2. Create a ticket

a) To create incident:

Action: POST 

URL: http://<SDM hostname>:<REST Port>/caisd-rest/in

Example: http://sdmservername:8050/caisd-rest/in

Headers

X-AccessKey: <Access Key generateed in the step 1>
Accept: application/json
Content-Type: application/json; charset=UTF-8
X-Obj-Attrs: ref_num
Cache-Control: no-cache

Body;

{
"in": {
"requestor": {
"@id": "U'F4C2A60100EA154695D233F90ABFFD21'"
        },
"customer": {
"@id": "U'F4C2A60100EA154695D233F90ABFFD21'"
        },
"requested_by": {
"@id": "U'F4C2A60100EA154695D233F90ABFFD21'"
        },
"summary": "Resumen json prueba",
"description": "Descripcion json prueba"
    }
}

Code Snippet:

 
curl --location --request POST 'http://sdmservername:8050/caisd-rest/in' \
--header 'X-AccessKey: 565476094' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json; charset=UTF-8' \
--header 'X-Obj-Attrs: ref_num' \
--header 'Cache-Control: no-cache' \
--data-raw '{
    "in": {
        "requestor": {
            "@id": "U'\''F4C2A60100EA154695D233F90ABFFD21'\''"
        },
        "customer": {
            "@id": "U'\''F4C2A60100EA154695D233F90ABFFD21'\''"
        },
        "requested_by": {
            "@id": "U'\''F4C2A60100EA154695D233F90ABFFD21'\''"
        },
        "summary": "Resumen json prueba",
        "description": "Descripcion json prueba"
    
    }
}'

b) To create a request:

Action: POST 

URL: http://<SDM hostname>:<REST Port>/caisd-rest/cr
Example: http://sdmservername:8050/caisd-rest/cr

Headers

X-AccessKey: <Access Key generateed in the step 1>
Accept: application/json
Content-Type: application/json; charset=UTF-8
X-Obj-Attrs: ref_num
Cache-Control: no-cache

Body;

{
"cr": {
"requestor": {
"@id": "U'F4C2A60100EA154695D233F90ABFFD21'"
        },
"customer": {
"@id": "U'F4C2A60100EA154695D233F90ABFFD21'"
        },
"requested_by": {
"@id": "U'F4C2A60100EA154695D233F90ABFFD21'"
        },
"summary": "Resumen json prueba",
"description": "Descripcion json prueba"
    }
}

 

Code snippet:

curl --location --request POST 'http://lvntest005275.bpc.broadcom.net:8050/caisd-rest/cr' \
--header 'X-AccessKey: 565476094' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json; charset=UTF-8' \
--header 'X-Obj-Attrs: ref_num' \
--header 'Cache-Control: no-cache' \
--data-raw '{
    "cr": {
        "requestor": {
            "@id": "U'\''F4C2A60100EA154695D233F90ABFFD21'\''"
        },
        "customer": {
            "@id": "U'\''F4C2A60100EA154695D233F90ABFFD21'\''"
        },
        "requested_by": {
            "@id": "U'\''F4C2A60100EA154695D233F90ABFFD21'\''"
        },
        "summary": "Resumen json prueba",
        "description": "Descripcion json prueba"
    
    }
}'

Additional Information

How to create a Change Order via REST API using JSON instead of XML?