Search This Blog

Wednesday, August 14, 2019

MAXIMO: REST API Example - Change Person/User/Labor status

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.

maximo REST api













Next we have to configure Object Structure Security , starting version 7.6.0.5 IBM introduced capacity to grant access at Object Structure level. Refer below screenshot.

maximo REST api















Additionally we need to grant Object Structure access to group /User which is being used by REST to update the records. Example screenshot :

maximo REST api














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 :
   
maximo REST api
   
maximo REST api














 b) Deactivation Script :
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:
maximo REST api













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
maximo REST api

maximo REST api














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.
maximo REST api


















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:

maximo REST api












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 rest api











Maximo result screenshot having records inactivated :
maximo rest api
maximo rest api

maximo rest api













b) Activation REST call via Postman client :

maximo rest api

Similarly associated User and Labor record got activated via this request , I have added below automation script for the same.

Launch Point Type : Object Launch Point
Object : PERSONSTATUS
Events : Save , Add , After Save

maximo rest api
maximo rest api
maximo rest api

2 comments:

Jitesh said...

Very Good post.

Anonymous said...

Informative!. Thanks for detailed explaination