↓ Skip to main content
A pen and ink drawing of a wooden writing desk. On it stands an open wooden card box with a row of teal index cards, and one orange card stands among them, taller than the rest. Beside the box lie a rubber stamp with a brass handle and an open orange ink pad. In front, a fountain pen rests on a blank sheet of paper, with books, a pen pot and a plant around the desk.

Create, Update and Merge in the Maximo REST API

The Maximo REST API in Practice - This article is part of a series.
Part 7: This Article
The first part of this series read data. This article starts the second part: writing it. It shows how to create a record, update it, and get the result back in the same call. Most of it is about child objects, because one missing header there deletes data without a warning.

The rules here come from IBM’s documentation and from our own work with the REST API, on Manage in the MAS 9.2 series. We ran every request on our test system, against IBM’s demo data, as a user without administrator rights, on test assets made for this article. The examples write to the object structure MXAPIASSET and its meters.

Three kinds of write
#

Every write in this article is a POST. The URI and two headers decide what Manage does:

The URI and two headers decide what a POST does The URI and two headers decide what a POST does
The URI and two headers decide what a POST does

Create a record
#

POST the attributes to the collection URI, the same URI you query:

POST /maximo/api/os/mxapiasset?lean=1
{
  "assetnum": "DEMO-100",
  "siteid": "BEDFORD",
  "description": "Cooling water pump"
}

Manage answers 201 with an empty body. The Location header holds the URI of the new record:

Location: …/maximo/api/os/mxapiasset/_REVNTy0xMDAvQkVERk9SRA--

The last part is the rest id. It is the key values of the record, DEMO-100/BEDFORD, in base64 with a few characters swapped. Take it from Location or from the href of a query, and do not build it yourself.

Two answers you will meet early:

  • The key exists already. 400 BMXAA4129E, “The record for Site=BEDFORD, Asset=DEMO-100 already exists”.
  • A value is wrong. An unknown site gives 400 BMXAA4153E, “NOSITE is not a valid site”.

The properties header
#

The request header properties makes Manage read the record again after the save and return it, so you need no second GET:

POST /maximo/api/os/mxapiasset?lean=1
properties: assetnum,siteid,status,description,assetuid
{
  "assetnum": "DEMO-100",
  "siteid": "BEDFORD",
  "description": "Cooling water pump",
  "status": "NOT READY",
  "status_description": "Not Ready",
  "assetuid": 8910,
  "_rowstamp": "[0 0 0 0 0 115 91 21]",
  "href": "…/api/os/mxapiasset/_REVNTy0xMDAvQkVERk9SRA--"
}

The value follows the rules of oslc.select. It takes child objects in braces, such as assetmeter{metername,lastreading}, and * for all attributes. A name the object structure does not have is left out without an error, as in oslc.select. The answer shows what Manage filled in itself: the status, the unique id and the _rowstamp. The example is shortened: the real answer also holds a _collectionref for each child list of the record.

Update a record
#

POST to the record URI with the header x-method-override: PATCH:

POST /maximo/api/os/mxapiasset/_REVNTy0xMDAvQkVERk9SRA--?lean=1
x-method-override: PATCH
properties: assetnum,description
{
  "description": "Cooling water pump, north side"
}

Only the attributes in the body change. Manage answers 204 with no body, or 200 with the record when properties is set. What we saw around it:

  • Use POST with the override. The HTTP method PATCH is refused with 501 before Manage sees the request. PUT works like POST. The override value is read in any case, patch works too.
  • Mind the URI. A POST without the override to a record URI is refused with BMXAA10175E, “Attempting record creation using URI meant for updates”. A PATCH to the collection URI is refused with BMXAA10013E. An unknown rest id answers 404 with BMXAA8727E.
  • An unknown attribute in the body is ignored. A body with the typo descripton answered 200, and nothing changed. Set properties and compare the answer with what you sent.
  • Values are checked as in the application. Text in a number field gives BMXAA7094E, an unknown location BMXAA2659E.
  • The status is refused in the body with BMXAA0029E, “You are not authorized to perform this action”. A status change is an action, which a later article of this series covers.

Two clients, one record: _rowstamp
#

Every record you read carries a _rowstamp. Send it back in the body of the update:

{
  "description": "Cooling water pump, north side",
  "_rowstamp": "[0 0 0 0 0 115 91 48]"
}

When someone saved the record after you read it, Manage refuses the update with 412 BMXAA8229W, “Record … has been updated by another user. Your changes have not been saved”. Without _rowstamp the last write wins.

The ETag header of a GET is no help here. On our test system it was always 0, and an update with If-Match: 0 was refused with the same 412. Use _rowstamp.

Child objects
#

A record in an object structure carries its child objects as arrays, such as the meters of an asset in assetmeter. How Manage reads such an array depends on one header.

A plain PATCH replaces the children
#

With x-method-override: PATCH alone, an array in the body is the complete new list. Manage deletes every child of that kind that is missing from the array. We started each line below with an asset that had three meters, CS-VALUE, DGA-C2H2 and DGA-C2H4:

PATCH bodyMeters after the save
description only, no assetmeterall three, unchanged
assetmeter with CS-VALUEonly CS-VALUE
assetmeter with DGA-C2H2 and "_action": "Delete"only DGA-C2H2
"assetmeter": []none

The third line is the dangerous one. The client meant to delete one meter. Manage kept exactly that meter and deleted the other two, without an error.

patchtype: MERGE keeps them
#

Add the header patchtype: MERGE, and Manage matches each child in the array with the existing ones. A match is updated, a new key is added, and every other child stays:

POST /maximo/api/os/mxapiasset/_REVNTy0xMDAvQkVERk9SRA--?lean=1
x-method-override: PATCH
patchtype: MERGE
properties: assetnum,assetmeter{metername,remarks}
{
  "assetmeter": [
    {
      "metername": "CS-VALUE",
      "linearassetmeterid": 0,
      "remarks": "updated"
    },
    {
      "metername": "CS-STATUS",
      "linearassetmeterid": 0
    }
  ]
}

The asset now has four meters: CS-VALUE with the new remark, the new CS-STATUS, and the two it had before. Two details:

  • MERGE in capitals. patchtype: merge was ignored on our test system, and the request ran as a plain PATCH: the other meters were deleted.
  • Send every key of the child. A meter is found by metername and linearassetmeterid, which is 0 on an asset that is not linear. IBM’s examples name linearassetid instead. Without linearassetmeterid our requests were refused with BMXAA1339E, “Missing key value for key LINEARASSETMETERID”.

Find a child by its href
#

Each child in a GET carries an href and a localref:

{
  "metername": "CS-STATUS",
  "href": "http://childkey#QVNTRVQvQVNTRVRNRVRFUi9…",
  "localref": "…/api/os/mxapiasset/_REVN…/int_assetmeter/0-369"
}

The href names the child by its keys. In a merge it can stand for the key attributes:

{
  "assetmeter": [
    {
      "href": "http://childkey#QVNTRVQvQVNTRVRNRVRFUi9…",
      "remarks": "set by href"
    }
  ]
}

The href is a name and no address: its host is childkey. The localref is the real URI of the child, used for a DELETE below.

Delete one child
#

Two ways worked on our test system:

  • "_action": "Delete" in a merge. The child with these keys is deleted, and the others stay. It needs patchtype: MERGE, as the table above shows.
  • HTTP DELETE on the localref. Manage answers 204, and the child is gone. A DELETE on the child list, such as …/int_assetmeter, is refused with 405 BMXAA8815E.
{
  "assetmeter": [
    {
      "metername": "DGA-C2H4",
      "linearassetmeterid": 0,
      "_action": "Delete"
    }
  ]
}

A meter reading
#

A reading is a change of the meter child. The non-persistent attributes newreading and newreadingdate carry it, in a merge:

{
  "assetmeter": [
    {
      "metername": "CS-VALUE",
      "linearassetmeterid": 0,
      "newreading": "42",
      "newreadingdate": "2026-10-28T08:00:00"
    }
  ]
}

After the save, lastreading of the meter is 42. Both attributes are part of MXAPIASSET in a standard installation.

Errors at a glance
#

RequestAnswerFix
create with a key that exists400 BMXAA4129Eupdate the record instead
POST to a record URI without override400 BMXAA10175Eadd x-method-override: PATCH
PATCH to the collection URI400 BMXAA10013Euse the record URI
the HTTP method PATCH501POST with x-method-override
an unknown rest id404 BMXAA8727Etake the URI from Location or href
an attribute name with a typo200, nothing changedcheck the answer of properties
a stale _rowstamp, or If-Match: 0412 BMXAA8229Wread the record again
status in the body400 BMXAA0029Echange the status with its action
a child without all its keys400 BMXAA1339Eadd every key, such as linearassetmeterid
DELETE on a child list405 BMXAA8815EDELETE each localref
DELETE on an asset400 BMXAA0024Eassets are decommissioned

The last line held for an administrator too: Manage does not delete an asset through MXAPIASSET.

Examples
#

Each request below ran on our test system.

Create an asset and get it back:

POST /maximo/api/os/mxapiasset?lean=1
properties: assetnum,status,href
{
  "assetnum": "DEMO-101",
  "siteid": "BEDFORD",
  "description": "Spare cooling water pump"
}

Add a meter and keep the others:

POST /maximo/api/os/mxapiasset/<rest id>?lean=1
x-method-override: PATCH
patchtype: MERGE
properties: assetmeter{metername}
{
  "assetmeter": [
    {
      "metername": "CS-STATUS",
      "linearassetmeterid": 0
    }
  ]
}

Change a description, safe against a parallel change:

POST /maximo/api/os/mxapiasset/<rest id>?lean=1
x-method-override: PATCH
properties: description,_rowstamp
{
  "description": "Spare pump, store room 2",
  "_rowstamp": "<the value from your GET>"
}

What comes next
#

IBM’s own pages are the reference to keep next to this article:

The next article writes many records in one request: bulk requests, the allornothing header and SYNC. The series overview lists all parts. If you want help with the REST API in your own Manage, our services page shows how we work, or get in touch.

IBM and Maximo are trademarks of International Business Machines Corporation, registered in many jurisdictions worldwide.

The Maximo REST API in Practice - This article is part of a series.
Part 7: This Article