Monday, November 28, 2016

REST API POST method to update related objects in Maximo

REST API allows external applications to query & update application data.

I would like to explain the POST method to insert or update a resource (or record) in Maximo. 
The below example has a Object structure (mxworkperiod) with Calendar and work period objects. We are updating a work hours on a particular date.

https://<hostname>:<port>/maxrest/rest/os/mxworkperiod/<calendaruid>?_action=AddChange&_lid=maxadmin&_lpwd=maxadmin
&orgid=NON CO&workperiod.1.workdate=2016-09-27&workperiod.1.shiftnum=08-12&workperiod.1.starttime=08:00&workperiod.1.endtime=12:00&workperiod.1.workhours=10.0


<hostname>:<port>                      - application hostname
maxrest/rest/os/mxworkperiod     -  common url where mxworkperiod is object structure name with a sequence of Maximo objects.
<calendaruid>                               - The Unique ID from the table ( not the calendar name in UI)
_action                                          - parameter can be [Change or AddChange]
_lid & _lpwd                                 - Maximo application username and password
 workperiod.1.workdate                - workperiod is the object name in the object structure;1 - any unique id value to add a related record or existing uniqueid of the related record to update the related object; workdate - attribute in related object


provided all the mandatory fields are passed on the POST call , Maximo will create/update a related object.

You can also refer to the below link on how we can update a PO, add 2 PO lines and each line has 2 POCOST values.