Maximo

Maximo

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

 View Only
  • 1.  NextGen REST API vs AddChange

    Posted Tue February 20, 2024 12:07 PM

    Hi,
    with the NextGen REST API, do you have any idea what combination of request method and the x-method-override and patchtype headers is required to achieve behaviour identical to the Synch&AddChange of the MIF (link)? 
    That is:
    - create the record if it does not exist
    - update the primary record if it exists
    - update sub-records if they exist
    - leave sub-records not included in the request intact



    ------------------------------
    Diego Visentin
    EAM BU Director
    Tempestive S.p.A.
    ------------------------------


  • 2.  RE: NextGen REST API vs AddChange

    Posted Wed February 21, 2024 04:18 AM
    Edited by HANBALI Youssef Wed February 21, 2024 04:19 AM
    Hi Diego,
     
    To achieve behavior identical to the Synch&AddChange of the MIF with the NextGen REST API, you can use the combination of the HTTP method `PATCH` along with the following headers:
     
    - `x-method-override: PATCH`
    - Choose one of the following:
      - `patchtype: MERGE`
      - `patchtype: MERGESYNC`
    I've conducted some quick tests, but I haven't delved deeply into the topic. 


    ------------------------------
    ------------------------------
    Youssef HANBALI
    Architect Solutions IBM Maximo
    ------------------------------
    ------------------------------



  • 3.  RE: NextGen REST API vs AddChange

    Posted Thu February 22, 2024 06:49 AM

    Hi Youssef,
    thanks for your suggestion but the PATH method requires the use of the url with the 'rest-id' and therefore only works when updating a pre-existing record.
    So it is not able to create new records as is the case with the Synch-AddChange of the MIF.



    ------------------------------
    Diego Visentin
    EAM BU Director
    Tempestive S.p.A.
    ------------------------------



  • 4.  RE: NextGen REST API vs AddChange

    Posted Wed February 21, 2024 08:09 AM

    Hi Diego,

    X-Method-override of Patch with Merge as Patch type works well for all the above transaction but the catch to merge is that you need to Get record api url ( unique url for each record) and then use that with Merge patch type.

    Recently, we tried couple of other API calls using X-method-override which does not need an additional call for getting the unique record url:

    1. BULK
    2. SYNC

    Both BULK and Sync methods works without an url and similar to current integration where passing primary key for the object is recognised by Maximo. 

    Additionally, we used _action:"AddChange" for ensuring that maximo updates the records and not create new.

    Sample JSON from IBM rest api documentation:

    POST /oslc/os/mxapiasset properties:* X-method-override: BULK

    [ { "assetnum":"...", "siteid":"....", "description":"...", "_action":"Add" },

    { "href":"...", "description":"...", "_action":"Update" },

    { "href":"...", "_action":"Delete" } ]

    BULK and SYNC both work similar and work well for updating multiple records in one payload. From memory, the only difference was the way the error transactions were handled and error responses were built for these methods.



    ------------------------------
    Biplab Choudhury
    IBM Champion 2022
    Senior Consultant
    BPD Zenith
    Melbourne
    ------------------------------



  • 5.  RE: NextGen REST API vs AddChange

    Posted Thu February 22, 2024 06:45 AM

    Hi Biplab,
    I had tried with the SYNC method but without obtaining the desired behavior.
    The use of BULK was my last resort but I thank you because specifying the AddChange action from the first tests seems to work as I wished.
    I will do more in-depth ones but the premises are good.

    Thank you very much.



    ------------------------------
    Diego Visentin
    EAM BU Director
    Tempestive S.p.A.
    ------------------------------