Creating a ticket via template through REST Web Services
search cancel

Creating a ticket via template through REST Web Services

book

Article ID: 376694

calendar_today

Updated On:

Products

CA Service Desk Manager CA Service Management - Service Desk Manager

Issue/Introduction

This article discusses the complexities of creating a ticket (request/incident/problem) through a pre-defined template

Environment

All releases of SDM up to 17.4

Cause

At the basic level, it is impossible to create a ticket via a template through a single REST web service call.  The current REST architecture does not support such a functionality and is a limitation on the functionality.

Resolution

The following is a workaround one may try to follow to create a ticket through a template via REST, as there are several REST calls involved.

  • Firstly, Make a GET call to http://SDM-SERVER:8050/caisd-rest/cr_tpl/56789 by passing X-Obj-Attrs header as template. (Assuming 56789 is the incident template Id we want to create ticket from)
    • The response for this would be -------"template": {

                     "@id"12345,

                     "@REL_ATTR""cr:12345",             <== THIS IS THE ACTUAL TICKET ID which is the template

                     "@COMMON_NAME"55,

                     "link": {

                     "@href""http://SDM-SERVER:8050/caisd-rest/cr/12345",

                     "@rel""self"

                 }

  • Secondly, Make a GET call to http://HOSTNAME:8050/caisd-rest/in/12345 with X-Obj-Attrs as * or fields of interest that I want for new ticket in third step 
    (
    summary,description,category,priority,assignee,group,urgency,impact,affected_resource,symptom_code,resolution_code,resolution_method,caused_by_chg,external_system_ticket)

    XXXX is the UUID of the given CI that needs to be included in the ticket, in this case, TestCI.
    YYYY is the UUID of the given contact designated as the assignee, in this case, the ServiceDesk user

    • The response for this would be -----"affected_resource": {

                       "@id""U'XXXX'",

                       "@REL_ATTR""U'XXXX'",

                       "@COMMON_NAME""TestCI",

                       "link": [

                       {

                          "@href""http://SDM-SERVER:8050/caisd-rest/nr/U'XXXX'",

                          "@rel""self"

                       },

                      {

                         "@href""http://SDM-SERVER:8050/caisd-rest/har_serx/U'XXXX'",

                         "@rel""extension"

                      }

                  ]

                 },

                 "assignee": {

                    "@id""U'YYYY'",

                    "@REL_ATTR""U'YYYY'",

                    "@COMMON_NAME""ServiceDesk",

                    "link": {

                         "@href""http://SDM-SERVER:8050/caisd-rest/agt/U'YYYY'",

                         "@rel""self"

                   }

              },.........................

  • Thirdly, Make a POST call to create ticket http://SDM-SERVER:8050/caisd-rest/in with the values from previous call.
    • The sample POST Body should be ---- {

                      "in": {

                          "customer": {

                             "@COMMON_NAME""ServiceDesk"

                          },

                         "base_template": {

                              "@REL_ATTR""cr:12345"

                         },

                         "affected_resource": {

                              "@COMMON_NAME""TestCI"

                         },

                        "assignee": {

                             "@COMMON_NAME""ServiceDesk"

                        },--------

Additional Information

Sample-376694.json attached to this KB Article illustrates the above functionality.

Broadcom Support is not permitted to assist in developing any custom code.  The attached code and the above document is provided as-is for reference and is not intended for use in a production instance.  Please try the above in a testing instance.

Attachments

Sample-376694.json get_app