Maximo REST API - IBM Community

Post on 16-Oct-2021

3 views 0 download

transcript

Maximo REST APIAnamitra Bhattacharyya

IBM STSM, Maximo

Steve Hauptmann

Development Manager, Maximo

Evolution Of REST API’s

(-)Limited JSON Support (-)Create/Update Request needForm Data.(+)Zero Configuration

(+)Full JSON Support(-)Namespaced JSON(-)Extra configuration needed,

(+)Full JSON Support(+)Lean JSON(+)Zero configuration needed

Maximo 7116 Maximo 7505 Maximo 7602

OSLC (REST) API(Anywhere)

REST API REST JSON API(Maximo new UI, Anywhere Next, IoT)

REST JSON API

Security (Authentication+Authorization)

Action CRUD QueryBulk

OperationsAttached

Docs/Images

Automation Script

Workflow

App Service Automation Script

Java Method

Maximo Saved Query (SQL)

MXPO MXWO

JSON Schema

System

Memory/Heap

Thread

JVM QueuesMXASSET MXSR

Analytics/Reports

Profile

BO/OS MMI Admin

Password mgmt

Logging

UI IntegrationREST API

Basic Query with oslc where

Classic UI Interaction (Server state)

UI

Maximo Server 1 Maximo Server 2

Database

WO

PO

ASSET

Classic UI server failure (Server state lost)

UI

Maximo Server 1 Maximo Server 2

Database

WO

PO

ASSETApp State

Lost

Work Center UI Interaction (No Server state)

UI

Maximo Server 1 Maximo Server 2

Database

WO

PO

ASSET

Work Center UI server failure (No Server state)

UI

Maximo Server 1 Maximo Server 2

Database

WO

PO

ASSET ASSET WO

PO

Features

Dynamic Views/Paging/Query/SavedQuery.

Traversing Mbo relations.

Timeline queries, Search terms, relation filtering..

Handling Yes/No/Cancel interactions..Aggregation APIs..JSON Schemas..

OAS/Swagger 3.0 - Dynamic Documentation.

Open source Client Library (Java/Node)

.

Formulas/Scripts /Workflow/Birt integration..

Dynamic Views/Paging/Query/SavedQuery

• uri?oslc.select=attr1,attr2,child{attr4,attr5,grandchild{*}}

• uri?oslc.where=attr1 in [“val1”,”val2”] and attr2>200

• uri?savedQuery=name • Saved query can be SQL, Java, Auto Script• /apimeta/<os name> lists all saved queries for an Object Structure

• uri?oslc.pageSize=N

• Stable Paging – good for downloading large data sets.

• Auto paging – Helps prevent OOM for large dataset requests when no page size specified.

• Limit Paging – Helps prevent OOM for large dataset requests when high page size specified.

Features

Dynamic Views/Paging/Query/SavedQuery.

Traversing Mbo relations.

Timeline queries, Search terms, relation filtering..

Handling Yes/No/Cancel interactions..Aggregation APIs..JSON Schemas..

OAS/Swagger 3.0 - Dynamic Documentation.

Open source Client Library (Java/Node)

.

Formulas/Scripts /Workflow/Birt integration..

Traversing Mbo Relations

• uri?oslc.select=attr1,rel1.attr1,rel.rel2{attr1,attr2},rel.rel3.os {*}

• rel1.attr1 – 1:1 relations. Results in a JSON Object for property named “rel1”.

• rel.rel2 {attr1,attr2} – 1:* relations. Results in a JSON Array for property named “rel2”.

• rel.rel3.os {*} – 1:* relations. Results in a JSON Array with OS json (for the named os) as array members.

Features

Dynamic Views/Paging/Query/SavedQuery.

Traversing Mbo relations.

Timeline queries, Search terms, relation filtering..

Handling Yes/No/Cancel interactions..Aggregation APIs..JSON Schemas..

OAS/Swagger 3.0 - Dynamic Documentation.

Open source Client Library (Java/Node)

.

Formulas/Scripts /Workflow/Birt integration..

Timeline queries, Search terms, relation filtering

• uri?tlrange=-3M&tlattribute=dateattr[=indexdate]

• tlattribute - the timeline attribute to which the range applies. If no index data specified, its defaulted to the current date-time.

• tlrange – The range in Months (M)/Years (Y)/ Week (W)/ Days (D)/ Hour (h)/Min (m)/ Seconds (s). + and - indicates whether to add or substract from tlattribute date-time.

Features

Dynamic Views/Paging/Query/SavedQuery.

Traversing Mbo relations.

Timeline queries, Search terms, relation filtering..

Handling Yes/No/Cancel interactions..Aggregation APIs..JSON Schemas..

OAS/Swagger 3.0 - Dynamic Documentation.

Open source Client Library (Java/Node)

.

Formulas/Scripts /Workflow/Birt integration..

Handling Yes/No/Cancel interactions

• POST uri?interactive=1

• Response comes back as a Oslc Error with YNC details (the YNC id and YNC options)

• Use the yncuserinput request header with a value – ync id:ync user choice. The header value can be chained to support the stateless nature of the rest apis.

• The server side will process that response along with the request payload.

Features

Dynamic Views/Paging/Query/SavedQuery.

Traversing Mbo relations.

Timeline queries, Search terms, relation filtering..

Handling Yes/No/Cancel interactions..Aggregation APIs..JSON Schemas..

OAS/Swagger 3.0 - Dynamic Documentation.

Open source Client Library (Java/Node)

.

Formulas/Scripts /Workflow/Birt integration..

Aggregation APIs

• GET uri?gbcols=status,count.*,sum.attr1&gbsortby=-count.*

• Also supports date histograms – yearly/quarterly/monthly/weekly. For example GET /mxapiwodetail? gbcols=year$statusdate,quarter$statusdate,sum.actlabhrs

Features

Dynamic Views/Paging/Query/SavedQuery.

Traversing Mbo relations.

Timeline queries, Search terms, relation filtering..

Handling Yes/No/Cancel interactions..Aggregation APIs..JSON Schemas..Formulas/Scripts /Workflow/Birt integration..

OAS/Swagger 3.0 - Dynamic Documentation.

Open source Client Library (Java/Node)

.

JSON Schema

• GET jsonschema/mxapiwodetail – gets the schema for the OS, but one object at a time.

• GET jsonschema/mxapiwodetail?oslc.select=* - gets the full schema

• Support child object schemas GET jsonschema/mxapiasset/assetmeter

• Support schema views - Get jsonschema/mxapiasset?oslc.select=attr1,rel1.attr2

• Mbo schemas GET jsonmboschemas/asset

Features

Dynamic Views/Paging/Query/SavedQuery.

Traversing Mbo relations.

Timeline queries, Search terms, relation filtering..

Handling Yes/No/Cancel interactions..Aggregation APIs..JSON Schemas..Formulas/Scripts/Workflow/Birt integration..

OAS/Swagger 3.0 - Dynamic Documentation.

Open source Client Library (Java/Node)

.

Features

Dynamic Views/Paging/Query/SavedQuery.

Traversing Mbo relations.

Timeline queries, Search terms, relation filtering..

Handling Yes/No/Cancel interactions..Aggregation APIs..JSON Schemas..Formulas/Scripts/Workflow/Birt integration..

OAS/Swagger 3.0 - Dynamic Documentation.

Open source Client Library (Java/Node)

.

Features

Dynamic Views/Paging/Query/SavedQuery.

Traversing Mbo relations.

Timeline queries, Search terms, relation filtering..

Handling Yes/No/Cancel interactions..Aggregation APIs..JSON Schemas..Formulas/Scripts/Workflow/Birt integration..

OAS/Swagger 3.0 - Dynamic Documentation.

Open source Client Library (Java/Node)

.

API Keys• By default REST apis creates a maximo session for any user session.

• API keys are system generated keys for a user (1:1).

• API keys can optionally be created with an expiry time (in minutes).

• API keys allow a REST interaction without a maximo user session.

• No need to maintain JSESSIONID cookies on the client side. However client needs to include api keys for every rest call.

• For interactive authentication schemes (like SAML/OIDC), apikeys can be leveraged for head-less REST interactions. No need to create a separate LDAP repository.

Request Tracking• Message tracking was so far available only for JMS queue bound MIF

messages.

• Added support for REST request tracking in 7611.

• Can be enabled by setting the maximo property mxe.int.trackrestrequests=1

• To store the request payload set the property mxe.int.storerestmsg=1.

• The table can get big pretty fast – suggest archiving/purging at regular intervals based on the velocity of the requests.

Data Loading Features• Support for SYNC operation. This implies you can operate CRUD just

using the collection url (/oslc/mxapiasset) as opposed to (/oslc/mxapiasset/{id}).

• Support for export/import/import-preview of XML/CSV/JSON.

• Support for async export/import.

• Support for BULK JSON processing (with added support for “allornothing” mode).

Real Time Field Validations/Actions

• By default REST apis create/updates gets field validated only at the submit time.

• In classic Maximo UI, those validations happen near real time.

• Starting 7611 REST apis provide an option to do real time validations.

• To use that feature, use the request header setvaluemode with a value of 1. Also add the query parameter rsmeta=1 and the request header properties with the list of mbo attributes for response.

• The request header sevaluemode causes the server to do the validations, but not commit the request. rsmeta causes the server to send back the required, readonly, hidden flags of the mbo attributes.