26
Maximo REST API Anamitra Bhattacharyya IBM STSM, Maximo Steve Hauptmann Development Manager, Maximo

Maximo REST API - IBM Community

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Maximo REST API - IBM Community

Maximo REST APIAnamitra Bhattacharyya

IBM STSM, Maximo

Steve Hauptmann

Development Manager, Maximo

Page 2: Maximo REST API - IBM Community

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)

Page 3: Maximo REST API - IBM Community

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

Page 4: Maximo REST API - IBM Community

Classic UI Interaction (Server state)

UI

Maximo Server 1 Maximo Server 2

Database

WO

PO

ASSET

Page 5: Maximo REST API - IBM Community

Classic UI server failure (Server state lost)

UI

Maximo Server 1 Maximo Server 2

Database

WO

PO

ASSETApp State

Lost

Page 6: Maximo REST API - IBM Community

Work Center UI Interaction (No Server state)

UI

Maximo Server 1 Maximo Server 2

Database

WO

PO

ASSET

Page 7: Maximo REST API - IBM Community

Work Center UI server failure (No Server state)

UI

Maximo Server 1 Maximo Server 2

Database

WO

PO

ASSET ASSET WO

PO

Page 8: Maximo REST API - IBM Community

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..

Page 9: Maximo REST API - IBM Community

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.

Page 10: Maximo REST API - IBM Community

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..

Page 11: Maximo REST API - IBM Community

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.

Page 12: Maximo REST API - IBM Community

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..

Page 13: Maximo REST API - IBM Community

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.

Page 14: Maximo REST API - IBM Community

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..

Page 15: Maximo REST API - IBM Community

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.

Page 16: Maximo REST API - IBM Community

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..

Page 17: Maximo REST API - IBM Community

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

Page 18: Maximo REST API - IBM Community

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)

.

Page 19: Maximo REST API - IBM Community

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

Page 20: Maximo REST API - IBM Community

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)

.

Page 21: Maximo REST API - IBM Community

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)

.

Page 22: Maximo REST API - IBM Community

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)

.

Page 23: Maximo REST API - IBM Community

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.

Page 24: Maximo REST API - IBM Community

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.

Page 25: Maximo REST API - IBM Community

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).

Page 26: Maximo REST API - IBM Community

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.