Maximo

 View Only
Expand all | Collapse all

How to query service request by ticketid via rest

  • 1.  How to query service request by ticketid via rest

    Posted Thu March 16, 2023 04:11 PM

    New to maximo and wondering how to query a service request by the ticket number? I can query by the ticketuid like this:

    https:/site.com/maximo/api/os/MXAPISR?oslc.select=*&oslc.where=ticketuid=2314
    When I try to query by ticketid I get errors. Does anyone have the http call for querying on ticketid?


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



    #Maximo
    #AssetandFacilitiesManagement
    #MaximoIntegrationandScripting


  • 2.  RE: How to query service request by ticketid via rest

    Posted Thu March 16, 2023 04:37 PM

    see this doc on the Maximo REST api

    https://higherlogicdownload.s3-external-1.amazonaws.com/IMWUC/ec7c249b-c5b3-fe3f-cd7c-36b28016af7e_file.pdf?AWSAccessKeyId=AKIAVRDO7IEREB57R7MT&Expires=1679002603&Signature=%2FNIWcxUlg9zUtQMkcT33W9w0lMI%3D



    ------------------------------
    Tom Sarasin
    Maximo Designer
    IBM
    (978) 899-2592
    ------------------------------



  • 3.  RE: How to query service request by ticketid via rest

    Posted Tue March 21, 2023 09:35 AM

    This link takes to an empty xml file that says access denied.



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



  • 4.  RE: How to query service request by ticketid via rest

    Posted Tue March 21, 2023 09:45 AM

    Try https://community.ibm.com/community/user/asset-facilities/viewdocument/maximos-rest-api-aka-json-api-os?CommunityKey=ed77c224-45e2-47b0-b574-cc31496f9a41&tab=librarydocuments

    That should show you all of our files. The most valuable is the Maximo REST API Guide. 



    ------------------------------
    Steven Shull
    ------------------------------



  • 5.  RE: How to query service request by ticketid via rest

    Posted Tue March 21, 2023 11:17 AM

    Thanks!



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



  • 6.  RE: How to query service request by ticketid via rest

    Posted Fri March 17, 2023 08:37 AM

    As Tom mentioned, you want to read through the documentation. Our REST API has a ton of features and functionality around it.

    To answer your specific issue, my guess is that you have a string value in ticketid (IE SR1234) and didn't wrap the value in quotes. Thus you were getting an error like "

    BMXAA8744E - The OSLC query was not parsed. Ensure that the query in the HTTP request follows the correct syntax of the OSLC query specification" 
    Something that may not be obvious to someone new to the API is our new JSON API was built on top of our OSLC API. You will want to use the JSON API instead of the OSLC API implementation which requires adding a query parameter of lean=1. This avoids the namespaces and other complicated topics of OSLC. 
    My example here would be something like:
    https://mysite.com/maximo/api/os/mxapisr?lean=1&oslc.select=*&oslc.where=ticketid="SS1329"
    Also be careful to not use oslc.select=* in actual integrations. It's OK to use for initial testing of queries but applications don't need all the data available on the object structure. In addition to increasing the size of the payload, this causes additional queries to execute, additional java class logic to evaluate, etc. which slows down the request. In MXAPISR for example, we're going to query for WORKLOG, DOCLINKS, TICKETSPEC, SITE, etc. even if you aren't using that data. You want to build the oslc.select with just the attributes you need like oslc.select=ticketid,description,siteid,status


    ------------------------------
    Steven Shull
    ------------------------------



  • 7.  RE: How to query service request by ticketid via rest

    Posted Tue March 21, 2023 09:38 AM
    Edited by System Tue August 22, 2023 04:33 PM

    Yes that was it! I am able to successfully query a service request by ticket number. Thanks for your help. I am not going to be bringing back all fields, but wanted to see everything at first to see what was coming back. 



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



  • 8.  RE: How to query service request by ticketid via rest

    Posted Mon March 20, 2023 08:29 AM

    Hi Chris,

    You can use the below URL during the GET call if the search attribute is a primary key in your Object instead of using an additional oslc.where clause. 

    https:/site.com/maximo/api/os/MXAPISR/2314?oslc.select=*

    for non-primary key attribute you can use oslc.where clause.



    ------------------------------
    Subhransu Sekhar Sahoo
    ------------------------------



  • 9.  RE: How to query service request by ticketid via rest

    Posted Mon March 20, 2023 10:27 AM

    Talking about a primary key like this is confusing.

    In Maximo's UI, the Primary Key would be CLASS + TICKETID, both of which are alphanumeric and won't work in the GET URL as described. To use the GET URL, you would need to supply what the Maximo UI calls the Unique ID, which is always a single column with an integer value, which in this case would be TICKETUID.



    ------------------------------
    Blessings,
    Jason Uppenborn
    Sr. Technical Maximo Consultant
    Cohesive
    ------------------------------