Maximo Open Forum

 View Only

 Add/Change Record Using REST API

Jump to Best Answer
  • Integrations
Brian Poirier's profile image
Brian Poirier posted 04-18-2024 15:15

I am trying to setup a REST call to perform an add change function similar to mxloader on a company record. 

I would like to be able to just pass over the primary key and either create the record if it does not exists, or update the record if it does.  There is a thread  about this that says this should be feasible using the BULK override method.  When I send the below call i get this response  

"Error": {
        "reasonCode": null,
        "message": "oslc#expectedobjgotarray",
        "statusCode": "400"

POST /maximo/oslc/os/BSWVENDOR?Content-Type=application/json&X-method-override=BULK&lean=1 HTTP/1.1
Host: xxx
apikey: xxxxx


[
    {
    "_action":"AddChange",
    "orgid":"orgder",
    "company":"BPTEST1",
    "name":"testing from API",
    "paymentterms":"N30",
    "disabled":"1",
    "type":"V"
}
]

Alex Walter's profile image
Alex Walter Best Answer

Hey Brian,

Try wrapping your payload using the "member" key. Something like this:

{
  "member": [
    {
      "_action": "AddChange",
      "orgid": "ORGDER",
      "company": "BPTEST1",
      "name": "Testing from API",
      "paymentterms": "N30",
      "disabled": true,
      "type": "V"
    }
  ]
}

Side note, the query parameters that you're using (e.g. Content-Type and x-method-override) should be passed as HTTP headers along with the API Key.

Hope this helps,

Alex

Prashant Bavane's profile image
Prashant Bavane
Brian Poirier's profile image
Brian Poirier

@Alex Walter  Thank you.  That worked perfectly