Highlighted
Contributor.
Contributor.
1015 views

How to create Parent & Child Tickets in HPSM through REST or SOAP WebServices

Hello Experts,

I have requirement to create tickets in HPSM as Parent & Child Tickets using REST or SOAP Web Services.

Can you point me to a sample or a link on How to creating Tickets with Parent child relationship with REST or SOAP Web Services?

Thanks and best regards
Bala

4 Replies
Highlighted
Contributor.
Contributor.

Re: How to create Parent & Child Tickets in HPSM through REST or SOAP WebServices

@lingyanmeng

Will you be able to help me with my requirement?

Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: How to create Parent & Child Tickets in HPSM through REST or SOAP WebServices

Open the parent record first, and the API response will contain the ticket number of the newly-created record. Your script can get that ticket number from the response and then plug it into the "parent" field when creating the child record.

0 Likes
Highlighted
Contributor.
Contributor.

Re: How to create Parent & Child Tickets in HPSM through REST or SOAP WebServices

AChandler, Thanks much for your response.

I am new to HPSM and will be of great help if you can provide a sample code showcasing the usecase of adding parent child relationship between tickets (Ticket#001 is parent and Ticket#002 and Ticket#003 are child tickets).  

Best regards

Bala

0 Likes
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: How to create Parent & Child Tickets in HPSM through REST or SOAP WebServices

Writing an entire integration script would probably take more time than I have available right now. 🙂 However, what you want to do is POST a JSON payload to SM's REST endpoint for the type of ticket you want to create, first for the parent ticket. SM will respond with the data of that newly-created ticket, and you can then parse out the ticket number of the parent and use it when you POST again to the endpoint for the child record.

To get a sample of how your JSON payload should be formatted, you can do a GET at the endpoint and see how it responds. A quick Python example:

import requests
u = 'username'
p = 'password'
e = 'http://smAppServer:port/SM/9/rest/changes/C12345'
r = requests.get(e,auth=(u,p))
r.text

(You can do an equivalent call with Curl or in PowerShell, etc.) That ^ should give you an example of how a Change ticket looks, and you can then format your inbound JSON payload accordingly. Once you POST that payload over to /changes/ and it creates a Change ticket, you can extract the Change Number from its response and then POST again, this time to /changeTasks/, with that Change Number in the "ParentChange" field. That will create your child record.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.