Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  Create asset downtimereport using rest API

    Posted Tue October 20, 2020 09:38 PM

    Hello,

    I want to create a DOWNTIMEREPORT using the rest API.

    I tried this request:

    POST:

    http://servername/maxrest/rest/os/wo_objectstructure/woid?DOWNTIMEREPORT.id1.SITEID=site&DOWNTIMEREPORT.id1.ASSETNUM=asset&DOWNTIMEREPORT.id1.OPERATIONAL=0&DOWNTIMEREPORT.id1.STATUSCHANGECODE=ERRORCODE&DOWNTIMEREPORT.id1.ISRUNNING=0&DOWNTIMEREPORT.id1.ISDOWNTIMEREPORT=0&DOWNTIMEREPORT.id1.STATUSCHANGEDATE=19/10/2020 00:38&DOWNTIMEREPORT.id1.STARTDATESOURCE=REPORTDATE&DOWNTIMEREPORT.id1.WONUM=wonum&WONUM=wonum&SITEID=site

    wo_objectstructure: {WORKORDER, WORKORDER / DOWNTIMEREPORT}

    The request seems to work correctly, but nothing changes on the Maximo side.

    I also tried many other ways in vain.

    Maximo version: 7.5

    Thank you






    #Maximo
    #Support
    #AssetandFacilitiesManagement
    #SupportMigration


  • 2.  RE: Create asset downtimereport using rest API
    Best Answer

    Posted Thu October 22, 2020 06:54 AM

    Thanks for sharing this. I also check it on a trampoline website. If you've any other guide please share here.






    #Support
    #AssetandFacilitiesManagement
    #SupportMigration
    #Maximo


  • 3.  RE: Create asset downtimereport using rest API
    Best Answer

    Posted Thu October 22, 2020 08:58 AM

    Hello,

    I just figured out one work around to make this work.

    1) Create an automation script on the

    "DOWNTIMEREPORT.ISRUNNING" attribute:

    -----------------------Script---------------------------

    importPackage(Packages.psdi.mbo);

    importPackage(Packages.psdi.server);

    importPackage(Packages.psdi.util);

    importPackage(Packages.psdi.app.asset);

    if (!interactive)

    {

    operational = mbo.getInt("OPERATIONAL");

    changedate =

    mbo.getDate("STATUSCHANGEDATE");;

    code = mbo.getString("STATUSCHANGECODE");

    assetmbo = mbo.getAssetMbo();

    assetmbo.recordAssetStatusChange(mbo.getOwner(),changedate,code,operational==1);

    }

    ----------------------- End Script---------------------------

    2- Create an object structure (WO_DWNTIME) with

    "WORKORDER" as main object and "DOWNTIMEREPORT" as child

    object

    3- Make the POST request:

    Post: http://maximo_server/meaweb/os/WO_DWNTIME

    Content-Type: application/xml

    ----------------------- xml body---------------------------

    <SyncWO_DWNTIME

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xmlns="http://www.ibm.com/maximo">

    <WO_DWNTIMESet>

    <WORKORDER

    action="AddChange">

    <WORKORDERID>workorder_id</WORKORDERID>

    <SITEID>site</SITEID>

    <WONUM>wonum</WONUM>

    <DOWNTIMEREPORT

    action="Add">

    <SITEID>site</SITEID>

    <ASSETNUM>asset_num</ASSETNUM>

    <ISDOWNTIMEREPORT>0</ISDOWNTIMEREPORT>

    <STATUSCHANGEDATE>2020-10-19T17:30:00</STATUSCHANGEDATE>

    <STARTDATESOURCE>REPORTDATE</STARTDATESOURCE>

    <STATUSCHANGECODE></STATUSCHANGECODE>

    <OPERATIONAL>1</OPERATIONAL>

    <ISRUNNING>1</ISRUNNING>

    </DOWNTIMEREPORT>

    </WORKORDER>

    </WO_DWNTIMESet>

    </SyncWO_DWNTIME>

    I hope this can help someone else.

    BR






    #AssetandFacilitiesManagement
    #Support
    #SupportMigration
    #Maximo