Maximo

 View Only
  • 1.  OSLC JSON Rest API - Bulk update

    Posted Fri August 19, 2022 10:17 AM
    Hello,

    For performing the bulk update using OSLC JSON Rest API, we need to provide the "resource location". For example, the following cURL performs a bulk update on "person" MBO with the object structure lbl_ds_person (duplicate of mxperson).

    curl --location --request POST 'https://maximofac.dev.lbl.gov/maximo/api/os/lbl_ds_person?lean=1&apikey=* \
    --header 'Content-Type: application/json' \
    --header 'x-public-uri: https://maximofac.dev.lbl.gov/maximo/api/' \
    --header 'x-method-override: BULK' \
    --data-raw '[{
    "_data": {
    "personid": "813149",
    "firstname": "Pankaj-1",
    "lastname": "Bhide-1",
    "displayname": "Bhide,Pankaj",
    "supervisor": "016323",
    "lbl_org_level_1": "IC",
    "lbl_org_level_2": "BS",
    "lbl_org_level_3": "E",
    "lbl_status": "A",
    "department": "None",
    "droppoint": null,
    "location": null,
    "title": "CSE4",
    "hiredate": "1997-12-10T00:00:00",
    "locationorg": "LBNL",
    "locationsite": "FAC",
    "_bulkid": "813149"
    },
    "_meta": {
    "uri": null,
    "method": "PATCH",
    "patchtype": "MERGE"
    }
    }]'

    Please see the value of "url". It is null. As per IBM doc, I need to provide "http://...." locator of this person so that the API can update the row. However in the absence of any value against "uri", the API still updates the row with the supplied values in the payload.

    This can easily be reproduced. My question is - whether there is really a need to provide value for the "uri"? Or is this some undocumented feature that if the value of "uri" is null, then API will find out the row from the "key" and update the row?

    Did anyone experience the similar?

    ------------------------------
    Pankaj Bhide
    Computer Systems Engineer
    Berkeley National Laboratory
    Berkeley CA
    ------------------------------



    #AssetandFacilitiesManagement
    #Maximo
    #MaximoIntegrationandScripting


  • 2.  RE: OSLC JSON Rest API - Bulk update

    Posted Fri August 19, 2022 12:50 PM
    IBM support quoted that if we are supplying the primary key (personid in case of person MBO) as a part of payload, then, it is not required to supply the value of "uri" in the payload. I need to confirm the same rule for delete.

    ------------------------------
    Pankaj Bhide
    Computer Systems Engineer
    Berkeley National Laboratory
    Berkeley CA
    ------------------------------



  • 3.  RE: OSLC JSON Rest API - Bulk update

    Posted Mon August 22, 2022 08:20 AM
    We simplified the API even further in 7.6.0.8 so if you're on that version or higher, I'd recommend using that. If your JSON body looks like below (still utilizing the same X-method-override header of BULK), you can make changes to records or delete without having to add the _data or _meta.  

    [{
        "description":"Test changing description",
        "siteid":"BEDFORD",
        "wonum":"3732",
        "_action":"Change"
    },
    {
        "description":"Test changing description",
        "siteid":"BEDFORD",
        "wonum":"3733",
        "_action":"Change"    
    },
    {
        "siteid":"BEDFORD",
        "wonum":"3966",
        "_action":"Delete"    
    }]


    ------------------------------
    Steven Shull
    ------------------------------