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 APICreate a work order and add labor hours with Maximo REST >

Did You Know...

As Maximo Experts, we have developed Maximo adds on products to make Maximo work assignment simple, reporting easy, and facilitating service requests seamless. Check out our additional products EZPlanner, EZInsight, and EZRequest.

Find Out More

12 thoughts on “Creating a work order with Maximo’s REST API framework

  1. Is there any way to hide the lid and lpwd in the URL when the person would click Submit? We’re thinking of making a web interface for clients to be able to submit work order requests but we don’t want them seeing a username/password.

  2. I get the message “Sorry but you do not have access to this post/page.”, how can I view the content of “Creating a work order with Maximo’s REST API framework” I’m very interested in how this is implemented, also how would I create/update Work Activities as well?

    Thanks!

  3. I tried this code and
    1. It works in MX7506 NO LDAP.
    2. When LDAP is enabled the code fails with a 400 error
    – Any ideas will be appreciated.
    thanks

Leave a Reply

Your email address will not be published. Required fields are marked *