Creating a work order with Maximo’s REST API framework

In a previous tutorial, querying data use the REST API framework is fairly straight forward and much easier to use than WSDL web services. Now the question is, how do we update or create new records using this API? This tutorial will show you how to create a new work order using Maximo’s REST API.

In the previous tutorial, all the HTTP calls to the REST API are GET requests but when creating or updating records using the REST API, you have to send an HTTP POST request to the REST URL in order to save records. One simple way to do this is to create an HTML page to do the posting for you. In the end, this is probably how you would use this REST API anyways. Here is a sample HTML page to create a new work order.

<html>
<body>
<form name="input" action="http://maximoserver/maxrest/rest/os/MXWO?_lid=maxadmin&_lpwd=maxadmin" method="POST">
    LOCATION    <input name="LOCATION" value="SHIPPING" type="text"> <p/>
    DESCRIPTION <input name="DESCRIPTION" value="Test Rest" type="text"> <p/>

    SITEID      <input name="SITEID" value="BEDFORD" type="text"> <p/>
    ORGID       <input name="ORGID" value="EAGLENA" type="text"> <p/>

    <input type="submit" value="Submit">
</form>
</body>

To use this, open notepad and save this onto your desktop as a .html file such as “Create_WO.html”. Be sure to change the ‘action’ URL to point to your Maximo REST URL and set the username and password. Once saved, open it with your browser and you should see a form just like this:

Create Work Order with REST

Fill in the location value and description and hit submit. This will create a new workorder and actually return you an XML response of the record you created.

So let’s analyze the HTML. I won’t go into details about HTML forms but basically, you set the ‘action’ URL of the ‘form’ tag to point to the Object Structure or MBO that you want to post this data to. The URL structure is pretty much the same as when you query data. The big difference here is that the ‘method’ property is set to POST. If you change this to GET, you will basically be querying data instead of creating or updating a record in Maximo. Next, you can add as many ‘input’ tags as you want to create this work order, I just simply added the ‘LOCATION’ and ‘DESCRIPTION’ properties of the MXWO object. You can even change the initial status of this new work order by adding the ‘STATUS’ property and setting it to APPR or INPRG.

Series Navigation< Query data with the 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