Maximo Open Forum

 View Only

 Updating PO via rest call problem

  • Integrations
Jose Nodeland's profile image
Jose Nodeland posted 06-01-2025 11:05

I need some help with this ... am kind of flogging around and getting nowhere.  Any thoughts on how to correct/fix?

Environment: Currently Maximo 7.6.1.1, soon to be 7.6.1.3, soon to be upgraded to MAS

I'm trying to do a rest call from an external application to update the POLine VenDeliveryDate field, and am not having much success.  The version I'm trying now (using Postman to send to Maximo) is:

URL: https://myserver/maximo/api/os/MXPO?_lid=X0080892&_action=Update

Additional Headers: PATCHTYPE: MERGE, x-method-override: PATCH

This gives error:

{
    "oslc:Error": {
        "oslc:statusCode": "400",
        "spi:reasonCode": null,
        "oslc:message": "oslc#update_on_createuri"
    }
}
Changing patchtype to SYNC gives error:
{
    "oslc:Error": {
        "oslc:statusCode": "400",
        "errorattrname": "siteid",
        "spi:reasonCode": "BMXAA4153E",
        "errorobjpath": "po",
        "correlationid": null,
        "oslc:message": "BMXAA4153E - null is not a valid site. Enter a valid Site value as defined in the Organization Application.",
_______________________________________________________
Sending to URL https://myserver/maxrest/rest/os/MXPO?_lid=X0080892&_action=Update gives error:
Error 400: BMXAA4153E - null is not a valid site. Enter a valid Site value as defined in the Organization Application.
_____________________________________________________________
json sent in rest call is:
{
  "MXPO": {
    "PONUM": "X0080892",
    "SITEID": "BEDFORD",
    "ORGID": "EAGLENA",
    "REVISIONNUM": "0",
    "POLINE": [
      {
        "REVISIONNUM": "0",
    "POLINENUM": "1",
    "VENDELIVERYDATE": "2025-06-15"
      }
    ]
  }
}
Steven Shull's profile image
Steven Shull

I'm going to start with some documentation links. IBM Maximo REST API Guide – IBM Maximo REST API Guide & Maximo - IBM TechXchange Community

You have the newer JSON API in your first two examples and then switch to the legacy REST API in the third. The /maxrest context should not be used for anything new at this point. The two links above are only the newer JSON API.

The first error is because you the PATCHTYPE MERGE means you have the HREF to an existing record in the POST URL. IE after the /MXPO you would have something like /mxpo/_MTAwMS8wL0JFREZPUkQ-

That would inform which Maximo you are intended to update.

Since you likely don't want to get the HREF for your update, the second option of using SYNC would normally work but you are missing the ?lean=1 query parameter. The JSON API was built on top of our support of a standard called OSLC. Outside of some specific product situations (like Maximo Anywhere), OSLC is not really used. The lean=1 query parameter informs Maximo you want to use the JSON API. If you see the error message in the format oslc:Error, it means you are using the OSLC API rather than the JSON API. It requires everything to be defined very differently.

In the body, you should just have the contents inside of the MXPO section in your JSON sent for the REST call. And I would make the attribute names all lowercase to match how Maximo would send it. 

Something like:

{
    "ponum": "X0080892",
    "siteid": "BEDFORD",
    "orgid": "EAGLENA",
    "revisionnum": "0",
    "poline": [
        {
            "polinenum": "1",
            "vendeliverydate": "2025-06-15"
        }
    ]
}

Jose Nodeland's profile image
Jose Nodeland

Thanks Steven, that puts me on the right track.

I'm now sending the json you mentioned to https://myserver/maximo/oslc/os/MXPO?lean=1, but always get the Maximo login page.  Am using an api key for authentication (tested elsewhere, it works for queries).  Playing with various settings of patchtype and x-method-override makes no difference.

Any thoughts on this?

Steven Shull's profile image
Steven Shull

The JSON API can be authenticated a few different ways depending on your configuration in 7.6. But the majority will use API key for authentication where you will have a header of apikey with the API key token you created. The URL you would use is /maximo/api/os instead of /maximo/oslc/os. /maximo/oslc/os is problematic in SAML environments because it will redirect to your identity provider. 

In addition to the steps documented here:
IBM Maximo REST API Guide – Interfacing with REST apis using API keys

There is an Administration work center in 7.6 and an API key application in MAS for creating API keys. 

Jose Nodeland's profile image
Jose Nodeland

Thanks Steven, with your help I've eventually stumbled on the solution. For anyone else trying to figure this out, here is what works for me.  (using Postman, posting to maximo 7.6.1.1)

URL : https://myserver/maximo/api/os/MXPO?lean=1

Headers:

PATCHTYPE = MERGE

x-method-override = SYNC

Authorization

api key

Body

{
    "ponum": "X0080892",
    "siteid": "FS",
    "orgid": "UOFC",
    "revisionnum": 0,
    "poline": [
        {
            "polinenum": 1,
            "vendeliverydate": "2025-06-22"
        }
    ]
}