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:
- BULK
- 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
------------------------------
Original Message:
Sent: Tue February 20, 2024 12:07 PM
From: Diego Visentin
Subject: NextGen REST API vs AddChange
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.
------------------------------