Add Work Log to SR through Maximo REST API

Here is a common issue regarding how to add a work log to an SR record through the Maximo REST API. One of the biggest issue or error message is this:

Error 400: commlog#ownerNull

which is also noted here in our forum.  This error comes from using this REST url:

http://maximoserver/maxrest/rest/mbo/sr/1092/worklog

This REST call attempts to retrieve the SR record and the associated work logs with the “worklog” relationship.  And of course this relationship exists in Maximo but the API for some reason can’t retrieve the work log MBO set.  Notice here that the URL is using the ‘/rest/mbo/’ instead of the ‘/rest/os/’.  If you don’t know the difference, the ‘mbo’ API attempts to directly use the java MBO’s to retrieve data whereas the ‘os’ API needs to reference any objects that you define as Object Structures in the Integration Framework.  So what’s the difference? Well, with the ‘mbo’ you can reference any object defined in your Database Configuration such as WORKORDER, ASSET, LOCATION, PO, etc without having to define anything within the Integration Framework itself, whereas the ‘os’, you need to define an Object Structure such as MXWO, MXPERSON, etc., before you can use it via the REST API.  The URL for the ‘os’ would look something like this:

http://maximoserver/maxrest/rest/os/MXSR/1092

Now depending on how you setup the MXSR object structure, it will return you the data for a single SR record.

So how do you add a new Work Log using this API?  Below is the setup for the Object Structure and REST call to add a new Work Log.

First, you need to add the WORKLOG as a child object for the SR object and use the MODIFYWORKLOG relationship.

MXSR

Next, we can now POST data to this REST Object Structure to add a new work log.  This is the URL setup:

http://maximoserver/maxrest/rest/os/MXSR/1092

Where ‘1092’ is the uniquekey value of the SR record, in this case it’s the TICKETUID value.  So what data do you send to this API?  We will use the same trick used here so the format is this:

WORKLOG.ID1.SUMMARY = ‘This is a summary’
WORKLOG.ID1.DESCRIPTION = ‘This is a description’

Where ‘ID1’ is just a random ‘key’ to map the SUMMARY and DESCRIPTION fields together as one WORKLOG object.  You can add as many work logs as needed like so:

WORKLOG.ID1.SUMMARY = ‘This is a summary’
WORKLOG.ID1.DESCRIPTION = ‘This is a description’
WORKLOG.ID2.SUMMARY = ‘This is a summary TOO’
WORKLOG.ID2.DESCRIPTION = ‘This is a description TOO’

Here is a an example POST:

MXSR Post Sample

And here is the response after the insert…

MXSR Response Sample

Also… just and FYI, the tool I am using to POST data is a Chrome plugin called Postman

Series Navigation< Retrieving and Posting data to Maximo REST Web ServicesInitiate Workflow through Maximo REST API >

Did You Know...

As Maximo Experts, we have developed several add-on products for Maximo that mobilize the work force, simplifies assignments, provides ad-hoc reporting capabilities and facilitates the seamless integration of Service Requests into Maximo.

Check out our products by clicking on the following links: EZMaxMobileEZPLanner and EZInsight.

Find Out More

Leave a Reply