Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  How do you get the service request number returned of the one just created?

    Posted Wed May 17, 2023 07:24 AM

    If I am creating a service request via a rest post, how do you get the service request number of the newly created service request in Maximo? I'm using MAS8.



    ------------------------------
    Christopher Stewart
    ------------------------------

    #Maximo
    #MaximoIntegrationandScripting


  • 2.  RE: How do you get the service request number returned of the one just created?

    Posted Thu May 18, 2023 01:47 AM
    Edited by System Admin Tue August 22, 2023 04:33 PM

    As far as I know, when POST is done, there is response XML after successful POST, and in that response You should look for relevant attribute in that response, which will be <TICKETID> . If You want to do something more with that new record, then TICKETUID will be more usable.

    <SR rowstamp="631967472" xmlns="http://www.ibm.com/maximo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <TICKETID>1177</TICKETID>
       <CLASS>SR</CLASS>
       <DESCRIPTION>RESTtest2</DESCRIPTION>
       <STATUS>NEW</STATUS>
       <STATUSDATE>2023-05-18T08:44:42+03:00</STATUSDATE>
       <REPORTDATE>2023-05-18T08:44:42+03:00</REPORTDATE>
       <ISGLOBAL>0</ISGLOBAL>
       <RELATEDTOGLOBAL>0</RELATEDTOGLOBAL>
       <SITEVISIT>0</SITEVISIT>
       <INHERITSTATUS>1</INHERITSTATUS>
       <ISKNOWNERROR>0</ISKNOWNERROR>
       <CHANGEDATE>2023-05-18T08:44:42+03:00</CHANGEDATE>
       <CHANGEBY>XXXXXXXXXXXXX</CHANGEBY>
       <HISTORYFLAG>0</HISTORYFLAG>
       <TEMPLATE>0</TEMPLATE>
       <HASACTIVITY>0</HASACTIVITY>
       <ACTLABHRS>0.0</ACTLABHRS>
       <ACTLABCOST>0.0</ACTLABCOST>
       <TICKETUID>193</TICKETUID>
       <DUPFLAG>DUPLICATE</DUPFLAG>
       <LANGCODE>LV</LANGCODE>
       <ASSETFILTERBY>USERCUST</ASSETFILTERBY>
       <SLAAPPLIED>0</SLAAPPLIED>
       <HASLD>0</HASLD>
       <STATUSIFACE>0</STATUSIFACE>
       <CREATEWOMULTI>MULTI</CREATEWOMULTI>
       <SELFSERVSOLACCESS>1</SELFSERVSOLACCESS>
       <HASSOLUTION>0</HASSOLUTION>
       <PLUSSISGIS>0</PLUSSISGIS>
       <MXASSUBSTGR>0</MXASSUBSTGR>
       <MXASDUL>0</MXASDUL>
    </SR>



    ------------------------------
    Juris Flugins
    ------------------------------



  • 3.  RE: How do you get the service request number returned of the one just created?

    Posted Thu May 18, 2023 10:42 AM

    Thanks. I do not seem to be getting that returned with my post. Just a 201 response and some other header info, but not the XML. Do you have to pass anything with the request to tell it to return that info?



    ------------------------------
    Christopher Stewart
    ------------------------------



  • 4.  RE: How do you get the service request number returned of the one just created?

    Posted Thu May 18, 2023 11:20 AM

    I don't know :) SoapUI tool is receiving this. I don't know, if the same happens in some server connection.

    ChatGPT is telling something like this

    To receive an XML response after making a POST request in Maximo REST, you typically need to specify the desired response format in the request headers. Set the "Accept" header to "application/xml" or "text/xml" to indicate that you want the response in XML format. Additionally, ensure that your POST request includes the necessary data and parameters required by the Maximo REST API to generate the desired XML response.

    But I havent set tehere anything specific. Maybe SoapUI tool is adding by default, when sending POST request.



    ------------------------------
    Juris Flugins
    ------------------------------



  • 5.  RE: How do you get the service request number returned of the one just created?

    Posted Fri May 19, 2023 03:51 AM

    Hi Christopher,

    you should be able to specify attributes to return using the properties header in your request.

    E.g. properties: ticketid



    ------------------------------
    Jon Taylor
    Principal Consultant
    Vetasi Limited
    ------------------------------



  • 6.  RE: How do you get the service request number returned of the one just created?

    Posted Fri May 19, 2023 09:51 AM

    Thanks for the help. That worked for me!



    ------------------------------
    Christopher Stewart
    ------------------------------