IBM Maximo REST API Example - Change Person , User , Labor Status via REST call
In this post I will explain in details how to use Maximo's REST API framework to update data in Maximo with the example of changing Person status and status of associated User and Labor records.
Object Structure setup :
I am duplicating OOB MXPERSON object structure. I have removed related children objects , verified NP_STATUSIFACE and NP_STATUSMEMO fields included , STATUS and STATUSDATE fields had inbound restrictions applied etc.
Additionally we need to grant Object Structure access to group /User which is being used by REST to update the records. Example screenshot :
Automation Scripts :
In this use case I am going to use newly enabled capability of Integration Launch Points.
I am going to create two Object Structure based Action Processing launch points for Activation and Deactivation of Person/User/Labor records using REST calls.
a) Activation Script :
Crete Integration Launch Point with details as below :
- Type of Integration : Object Structure
- Object Structure : Select Object created earlier in step above , RESPERSON
- select "Action Processing" and provide Action name e.g. "ACTIVATE" to be called as REST
- Maximo will automatically create script name as "OSACTION.RESTPERSON.ACTIVATE"
- Provide description for script e.g. Activate Person and related associated Labor and User via REST
- Follow remaining areas and add automation script logic.
Refer below screen shots :
b) Deactivation Script :
Follow similar steps as above and create script for Deactivation
Follow similar steps as above and create script for Deactivation
Crete Integration Launch Point with details as below :
- Type of Integration : Object Structure
- Object Structure : Select Object created earlier in step above , RESPERSON
- select "Action Processing" and provide Action name e.g. "INACTIVATE" to be called as REST
- Maximo will automatically create script name as "OSACTION.RESTPERSON.INACTIVATE"
- Provide description for script e.g. Activate Person and related associated Labor and User via REST
- Follow remaining areas and add automation script logic.
Refer below screen shot:
Associating Action Definitions with Object Structure :
Now as we have defined Activate and Inactivate action processing automation scripts , these actions
needs to be associated with Object Strcture/s.
Using select action "Action Definition" as below :
Name : ACTIVATE
Description : Activate Person/User/Labor via REST call
Implementation Type : script
Script : OSACTION.RESTPERSON.ACTIVATE
Name : INACTIVATE
Description : De-Activate Person/User/Labor via REST call
Implementation Type : script
Script : OSACTION.RESTPERSON.INACTIVATE
Testing using REST client :
Now we will need to test and I will be using postman as rest client to send Activation and
Deactivation requests.
I have created "TESTUSR" person record and associated Labor and User records for testing purpose.
Also now we have to get REST URI for this person record using object structures apimeta information, verify your system properties for rest webapp url etc.
Sample url can be :https://host:port/maxrest/oslc
Here is my TESTUSR URI to be accessed over REST:
Now I am going to use this REST URI for person "TESTUSR" and call Activate and Inactivate actions via postman REST client.
Postman needs to set up with parameters like x-method-override , patchtype , contenttype etc.
You can refer below URLs for IBMs JSON/REST API documentation :
Below are screenshots from postman POST request to call INACTIVATE and ACTIVATE actions for TESTUSR Person/User/Labor records.
a) Deactivation REST call via Postman client :
Maximo result screenshot having records inactivated :
b) Activation REST call via Postman client :
2 comments:
Very Good post.
Informative!. Thanks for detailed explaination
Post a Comment