↓ Skip to main content
A pen and ink drawing of an open notebook on a workbench. The left page shows a sketch of a valve with orange and teal arrows, the right page holds ruled lines and a teal ribbon bookmark. Around it lie an orange pencil, a folding ruler, a torch, a spanner, a teal toolbox and a red cloth.

Maximo REST API Field Notes: When the Answer Looks Fine

The Maximo REST API in Practice - This article is part of a series.
Part 23: This Article
An error with a code is the easy case. The error code reference tells you what it means. The hard cases answer 200, 201 or 204, and the result is still wrong. These notes collect the ones we met. Each note names the symptom, the request, the cause and the fix.

The notes come from our work with the REST API in our own and customer systems. We ran every case again on our test system, on Manage in the MAS 9.2 series, as a user without administrator rights.

#SymptomCause in one line
1a field stays empty after a savethe attribute name was not in lower case
2every value reads as undefinedthe request had no lean=1
3a time is an hour offthe date had no time zone offset
4the JSON parser fails on <an API key on the login route
5every link points to localhostthe link base of the system
6a record just saved is not foundthe text search index lags
7a filter returns every recorda parameter name with a typo
8a selected column never comesthe object structure leaves it out
9a delete answers 204 and the record staysthe delete ran inside allornothing, or _Action
10the client gave up, and the record is therethe request was saved without an answer

1. A field stays empty after a save
#

Symptom. The create answers 201. The record exists, and its description is empty.

Request.

POST /maximo/api/os/mxapisr?lean=1

{ "DESCRIPTION": "Pump leaks at the seal" }

Cause. In lean mode, attribute names are lower case. Manage ignores a name it does not know, and DESCRIPTION is such a name. A typo such as descripton is ignored the same way: the update answered 200 and changed nothing.

Fix. Write every attribute in lower case. Send the header properties with the names you set, and compare the answer with the body you sent. A missing value then shows at once. See create, update and merge.

2. Every value reads as undefined
#

Symptom. The answer arrives, and the client finds no assetnum and no member.

Request. GET /maximo/api/os/mxapiasset?oslc.select=assetnum,status, without lean=1.

Cause. Without lean mode, every name carries a prefix. The records sit in rdfs:member, the paging data in oslc:responseInfo, and the attributes are spi:assetnum and spi:status. Errors change too: oslc:Error with spi:reasonCode.

Fix. Add lean=1 to every call. The whole series uses it.

3. A time is an hour off
#

Symptom. A client in Vienna sets a target start of 10:00. Manage saves 10:00 UTC, which is 11:00 in Vienna in winter.

Request.

{
  "description": "Replace the filter",
  "targetstart": "2030-01-15T10:00:00"
}

Cause. The date has no offset. Our Manage read it as UTC and answered 2030-01-15T10:00:00+00:00. A date without a time, 2030-01-15, became midnight UTC. When a start without an offset and a finish with one are compared, the order can flip, and Manage refuses the record with BMXAA8261E, “The Actual/Target finish date must be greater than the Actual/Target start date”.

Fix. Always send the offset, 2030-01-15T10:00:00+01:00, and convert the answers, which come in UTC, to the user’s time zone.

4. The JSON parser fails on <
#

Symptom. The client reports a JSON parse error at the first character. The body is an HTML page.

Request. Any call to /maximo/oslc/… with an API key.

Cause. /maximo/oslc sits behind the MAS login and does not read API keys. It answers 302, and a client that follows redirects ends on the login page.

Fix. Call /maximo/api/… with the key. Turn off automatic redirects, and treat a 302 as an error. See the two routes.

5. Every link points to localhost#

Symptom. The client follows href or Location and cannot connect.

Request. Any read. Every link starts with http://localhost/maximo/api/.

Cause. Manage builds its links from a system property, and on many systems that property names the internal host.

Fix. Send the header x-public-uri with the address your client uses, or take only the path from each link. See the two routes.

6. A record just saved is not found
#

Symptom. A create answers 201. A search for its description right afterwards finds nothing, not even with the exact text.

Request.

GET /maximo/api/os/mxapisr?lean=1&count=1
    &oslc.where=description="%Pump noise%"

Cause. On a service request, the description is searched through a text index of the database, and the index is updated with a delay. On our system the search found the new record less than a minute later. A search by key found it at once.

Fix. To check a save, read the record by its key or by the Location of the create. Use the description search for people, who can wait.

7. A filter returns every record
#

Symptom. The answer holds far more records than the filter allows.

Request. savedquery=ACTIVEANDNEWASSETS with a small q, or oslc.searchTerm=pump without the final s.

Cause. Manage ignores a query parameter it does not know. The request runs without the filter and answers 200.

Fix. Write savedQuery and oslc.searchTerms exactly. In a client, check totalCount against what the filter should allow. See saved queries.

8. A selected column never comes
#

Symptom. oslc.select names a column, and the answer leaves it out, without an error.

Request.

GET /maximo/api/os/mxapiasset?lean=1
  &oslc.where=assetnum="11300"
  &oslc.select=assetnum,iscalibration

Cause. The object structure decides which columns it answers. MXAPIASSET never answers iscalibration, although its own JSON schema lists it.

Fix. Check each selected name in the answer. Read such a column through another structure or a script. See object structure or business object.

9. A delete answers 204, and the record stays
#

Symptom. A bulk request reports 204 for a delete item. The record is still there.

Request. Two forms do this:

  • a delete item in a bulk request with the header allornothing: 1,
  • an item with "_Action": "Delete", with a capital A.

Cause. Inside allornothing, a delete is never saved. And JSON keys are case sensitive: _Action is no _action, so the item with an href becomes an update.

Fix. Send deletes in a request without allornothing, and write _action in lower case. Read the record afterwards. See bulk requests.

10. The client gave up, and the record is there
#

Symptom. A create timed out on the client. A second attempt created a second record.

Request. Any create whose answer is lost: a timeout, a reset connection, a client restart.

Cause. Manage saves the request even when the client is no longer listening. We aborted creates a few milliseconds after sending them, and Manage saved them anyway.

Fix. Send every create and update with a transactionid header, and send it again with the same id. A 409 with BMXAA9524E then means “already saved”. See duplicate requests, timeouts and retries.

The end of the series
#

This is the last part of the series. The series overview lists all parts, from the where clause to these notes. When you meet a case that belongs here, tell us: we add field notes as we find them. If you want help with the REST API in your own Manage, our services page shows how we work.

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 23: This Article