REST for cr workflow tasks creation

book

Article ID: 224290

calendar_today

Updated On:

Products

CA Service Management - Service Desk Manager CA Service Desk Manager

Issue/Introduction

Having trouble with the REST implementation. I need to create a method to create a Request Workflow task (cr_wf) and I can't get it to work. However, I use the same input data in a SOAP method (createObject) and it works. I need to know if I'm doing something wrong. Here are my REST and SOAP code.

REST:

<cr_wf>
 <tenant REL_ATTR="U'690AFF0F85FD2F4C8FCE5CDE3BA7D9E5'"/>
 <task REL_ATTR="APP"/>
 <delete_flag>0</delete_flag>
 <description>approve/reject</description>
 <object_type REL_ATTR="cr"/>
 <cr REL_ATTR="cr:1121095345"/>
 <sequence>230</sequence>
 <group_task>0</group_task>
</cr_wf>

SOAP:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.ca.com/UnicenterServicePlus/ServiceDesk">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:createObject>
         <sid>354338862</sid>
         <objectType>cr_wf</objectType>
         <attrVals>
            <!--1 or more repetitions:-->
            <string>tenant</string>
            <string>U'690AFF0F85FD2F4C8FCE5CDE3BA7D9E5'</string>
            <string>task</string>
            <string>APP</string>
            <string>description</string>
            <string>approve/reject</string>
            <string>object_type</string>
            <string>cr</string>
            <string>cr</string>
            <string>cr:5212206</string>
            <string>sequence</string>
            <string>230</string>
            <string>group_task</string>
            <string>0</string>
         </attrVals>
         <attributes>
            <!--1 or more repetitions:-->
            <string>persistent_id</string>
            <string>sequence</string>
         </attributes>
         <createObjectResult></createObjectResult>
         <newHandle></newHandle>
      </ser:createObject>
   </soapenv:Body>
</soapenv:Envelope>

Cause

Certain parameters can be omitted from the given REST call.

Environment

Release : 17.2

Component : SDM - Customizations

Resolution

The XML payload that was used to test this successfully was:

<cr_wf>
 <task REL_ATTR="APP"/>
 <description>test</description>
 <object_type REL_ATTR="cr"/>
 <cr REL_ATTR="cr:1121095345"/>
 <sequence>230</sequence>
 <group_task>0</group_task>
</cr_wf>

Ran a POST call via rest_access to obtain an access key.  The following screencap shows the execution work necessary to obtain the access key.

https://api-broadcom-ca.wolkenservicedesk.com/attachment/get_attachment_content?uniqueFileId=2cMXKK/V3rNCmZIYy9qxZQ==

Next, run a POST call via cr_wf, adding the X-AccessKey header definition of the access key obtained from the aforementioned rest_access activity.  The following screenshot shows where I applied the XML payload, where I used a new sequence number as number 230 was already being used, and the successful result showing the entry being added

https://api-broadcom-ca.wolkenservicedesk.com/attachment/get_attachment_content?uniqueFileId=WSZ/MrxqoDn5HIV65Uwtlg==

Additional Information

The above is based on the following tech articles to configure SOAPUI to test run REST calls

Using a tool to test CA Service Desk Manager REST Web Service functions
https://knowledge.broadcom.com/external/article?articleId=45577

Using SOAPUI and REST Web Services to create a CI Object
https://knowledge.broadcom.com/external/article?articleId=10574