4 Replies Latest reply on Jan 23, 2020 1:00 PM by Frederic Renaud

    Using Remedy REST API how can we add CI relationships to an incident?

    Frederic Renaud
      Share This:

      Hello,

       

      I'm a newbie with Remedy REST API (v9.1) and I need to create a few record types using curl commands.

       

      I've started playing with the incident form and I've managed to create an incident with a CI (HPD_CI) using the REST API, but I can't figure out how to add a "related to" relationship to additional CIs to an incident once the incident is created.

       

      I'm guessing that we need to create entries in an association form, but I'm not sure if we need to use HPD:Help Desk form or another one (ie: HPD:Associations?).

       

      I'd like to link ComputerSystem and/or SystemSoftware CI.

       

      I'd also like to query all the CI in the incident afterward.

       

      Any help is appreciated. Thanks.

        • 1. Re: Using Remedy REST API how can we add CI relationships to an incident?
          Sinisa Mikor

          Hello Frederic,

           

          to associate CI to an incident, create record in HPD:Associations; each association is unidirectional, so you will also need to associate incident to CI by creating record in AST:CMDB Associations before list of incidents associated to selected CI becomes available in Asset Management as well.  In both cases, there are nine mandatory fields (Form Name01, Request ID01, Request Type01, Request Description01, Form Name02, Request ID02, Association Type01, Status and Submitter); you might also need to use Parent Request ID, Request Type01 InstanceId and Request Type02 InstanceId.

           

          To get a feel for what records should look like, query HPD:Associations with Request Type01 = "Configuration Item" and AST:CMDB Associations with Request Type01 = "Incident".  Querying all CIs associated to incident can be done via GET on HPD:Associations with qualification set to 'Request ID02' = "<Incident Number>" AND 'Request Type01' = "Configuration Item" .

           

          P. S. Request ID of CI is its ReconciliationIdentity, and its equivalent for incident is Incident Number.

          • 2. Re: Using Remedy REST API how can we add CI relationships to an incident?
            Frederic Renaud

            Hi Sinisa,

             

            Thanks for the quick reply.  Is it possible to tell me the URL to use to create a record in HPD:Associations and AST:CMDB Associations?

             

            I've tried the following URL and both gives error "Error 415 Unsupported Media Type"

             

            http://server:8008/api/arsys/v1/entry/HPD:Associations_Create

            http://server:8008/api/arsys/v1/entry/HPD:Associations

             

            Thanks

            • 3. Re: Using Remedy REST API how can we add CI relationships to an incident?
              Sinisa Mikor

              I don't think that form HPD:Associations_Create exists in any version; second URL should be fine since form's name is always listed after entry.  That error message does not look like it was originated in HPD:Associations, it looks like HTTP Status -- how did you structure header and contents of message?  Is this error only showing up when you attempt to use POST with HPD:Associations, or regardless of destination form?

               

              Header should at least contain:

               

                   Content-Type: application/json

                   Authorization: AR-JWT <token>

               

              while body should be the usual

               

              {

                   "values":{

                        "<attribute 1>":"<value1>",

                        "<attribute 2>":"<value2>",

                        ...

                        "<attribute n>":"<value n>"

                   }

              }

              1 of 1 people found this helpful
              • 4. Re: Using Remedy REST API how can we add CI relationships to an incident?
                Frederic Renaud

                I was missing the header "Content-Type: application/json". 

                 

                Thanks a lot, works fine.

                 

                For reference, this is what I did:

                 

                curl -d "@/home/myuser/add-ci-incident.json" http://server:8008/api/arsys/v1/entry/HPD:Associations --header "Authorization: AR-JWT $TOKEN" --header "Content-Type: application/json" -i

                 

                HTTP/1.1 201 Created

                Date: Thu, 23 Jan 2020 18:06:48 GMT

                X-Frame-Options: SAMEORIGIN

                Content-Security-Policy: frame-ancestors 'self'

                Location: http://server:8008/api/arsys/v1/entry/HPD:Associations/HAS000008362156

                Content-Length: 0

                 

                add-ci-incident.json

                 

                {

                  "values": {

                        "Request ID01": "REHAA5V0GDJ6OAOPUR12O863IWM3QT",

                        "Request Type01": "Configuration Item",

                        "Request Description01": "my_ci_name",

                        "Form Name01" : "AST:SystemSoftware",

                        "Request ID02": "INC000012746648",

                        "Form Name02" : "HPD:Help Desk",

                        "Association Type01" : "Related to",

                        "Status" : "Enabled",

                        "Submitter" : "myuser"

                }

                }

                 

                REHAA5V0GDJ6OAOPUR12O863IWM3QT is the reconciliation identity of the CI

                INC000012746648 is my incident number

                 

                And the other way around  CI->Incident

                 

                curl -d "@/home/myuser/add-incident-to-ci.json" http://server:8008/api/arsys/v1/entry/AST:CMDB%20Associations --header "Authorization: AR-JWT $TOKEN" --header "Content-Type: application/json" -i

                HTTP/1.1 201 Created

                Date: Thu, 23 Jan 2020 18:29:59 GMT

                X-Frame-Options: SAMEORIGIN

                Content-Security-Policy: frame-ancestors 'self'

                Location: http://itsm-uat-ars.cwshs.com:8008/api/arsys/v1/entry/AST:CMDB%20Associations/AAA000009879324

                Content-Length: 0

                 

                add-incident-to-ci.json

                {

                  "values": {

                "Request ID01": "INC000012746648",

                "Request ID02": "REHAA5V0GDJ6OAOPUR12O863IWM3QT",

                "Request Type01": "Incident",

                "Request Description01": "my description",

                "Form Name01" : "HPD:Help Desk",

                "Form Name02" : "AST:SystemSoftware",

                "Association Type01" : "Related to",

                "Status" : "Enabled",

                "Submitter" : "myuser"

                }

                }