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

Parents Reply Children
  • 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

  • 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 = 'smAppServer:port/.../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.