IBM Maximo: Dicas de APIs Rest: Difference between revisions
Line 126: | Line 126: | ||
=== | === OSLC.SELECT === | ||
{| class="wikitable sortable" | {| class="wikitable sortable" | ||
|- | |- |
Revision as of 12:07, 27 January 2022
Arquitetura
- BO/OS: BO/Object Structure
- MMI: Maximo Management Interface
Documentação, Artigos e Technotes
- Documentação: Maximo's REST API (aka JSON API, OSLC API) Documentation
- Documentação: Maximo Manage REST APIs
- Artigo: Send notifications to Slack via Maximo Integration Framework
- Artigo: Custom autoscript end point realizes to access OAuth2 protected resources
URLs
- maximo/oslc/login or /j_security_check
- /maximo/oas3/api.html-> Maximo RESTful API - Swagger
- /maximo/oslc/oas?includeactions=1-> Maximo RESTful API - Swagger include actions
- /maximo/oslc/ -> Default uri os oslc
- /maximo/oslc/apimeta -> APIs Metadata. Metadata for all the object structures that are API eligible
- /maximo/oslc/license -> License Keys
- /maximo/oslc/members -> Server Members, API for the Maximo Management Interface (MMI).
- /maximo/oslc/members/thisserver ->This Server
- /maximo/oslc/products -> Installed Products
- /maximo/oslc/systeminfo -> System Info
- /maximo/oslc/version -> Version
- /maximo/oslc/whoami -> Who am I
- /maximo/oslc/sp -> Service Provider
Object Structures
- /maximo/oslc/os/MXINTOBJECT
- /maximo/oslc/os/MXOBJECTCFG
- /maximo/oslc/os/mxapiasset?attributesearch=[SPEED:>=50;AREA;ELEV:=300]
- Classification attribute search.
- /maximo/oslc/jsonschema/<object structure>
- 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
Headers
Key | Value | Description |
---|---|---|
maxauth=base64(username:password) | required | Username and Password encoded as base64 |
Content-Type=application/json | - | - |
Accept=application/json | - | - |
properties=* properties=attr1,attr2 |
usado no POST | Usar o header de properties elimina a necessidade de fazer um GET extra após um create ou update |
x-method-override: PATCH | usado no POST | informa ao servidor que será um update |
x-method-override: PATCH patchtype: MERGE |
usado no POST | informa ao servidor que será um update e atualiza os filhos |
Parameters
Key | Description |
---|---|
uri?lean=1 | simple notation |
uri?oslc.select | especifica o conjunto de atributos a serem buscados nas estruturas de objetos, bem como nos objetos relacionados. Veja seção os.select abaixo. |
uri/<os>?distinct=attr1&oslc.where=... | select DISTINCT Ex: site /os/mxapiasset?distinct=siteid&oslc.where=... |
uri?oslc.where | especifica a cláusula WHERE para filtrar o conjunto de resultados de uma consulta. Veja seção oslc.where abaixo. |
uri?oslc.orderBy uri?oslc.orderBy=-attr1,+attr2 |
especifica como os resultados de uma consulta são ordenados. O sinal de (-) para ordem decrescente e sinal de (+) para ordem crescente, sendo que o sinal + deve estar encoded. |
uri?oslc.paging=true | - |
uri?oslc.pageSize=N uri?oslc.pageSize=N&stablepaging=true |
especifica os recursos para cada página de uma consulta.
|
uri?savedQuery=name | Saved query can be SQL, Java, Auto Script. /apimeta/<os name> lists all saved queries for an Object Structure |
uri?actions=name | veja seção Actions abaixo |
uri?tlrange=-3M&tlattribute=dateattr[=indexdate] |
|
POST uri?interactive=1 | Handling Yes/No/Cancel interactions |
GET uri?gbcols=status,count.*,sum.attr1&gbsortby=-count.* |
Aggregation APIs.
Also supports date histograms – yearly/quarterly/monthly/weekly. |
uri?collectioncount=1 | retorna o totalCount e totalPages na reposta Set mxe.oslc.collectioncount system property to 1, the totalCount and totalPages parameters are included by default as part of the responseInfo. |
uri?count=1 | only the total count of records that match the query and not the records |
uri?_dropnulls=0 | To force the response to add null value attributes, API response skips the null value attributes by default |
uri?_format=xml uri?_format=csv |
type of output |
OSLC.SELECT
Key | Description |
---|---|
oslc.select=assetnum,location—mylocation | Apelido para atributo, para resolver conflitos de mesmo nome. Senão adicionado retorna $alias_this_attr$ |
oslc.select=attr1,attr2,child{attr4,attr5,grandchild{*}} | - |
oslc.select=attr1,rel1.attr1,rel.rel2{attr1,attr2},rel.rel3.os {*} |
|
/oslc/os/mxasset?oslc.select=assetnum,status,exp.myreplacecost |
create a object formula called MYREPLACECOST for asset object by using the Object Formula action in the Database Configuration application. The formula is purchaseprice/NVL(priority,1). |
/oslc/os/mxasset/{id}?oslc.select=assetnum,openwo.actlabhrs._dbmax, ... |
database aggregation (max,min,avg,sum,count, and exists) functions on related MboSets, must add _db prefix. |
oslc.select=assetnum,status&internalvalues=1 |
Domain internal values. Returns as <attribute name>_maxvalue property. |
OSLC.WHERE
Key | Description |
---|---|
uri?oslc.where=attr1 in ["val1","val2"] and attr2>200 | - |
uri?oslc.where=status in ["OPERATING","ACTIVE"] and priority=3 and statusdate>"ISO date string" and linear=false | - |
uri?oslc.where=objectname IN ["WORKORDER","WOACTIVITY] | - |
uri?oslc.where=priority in [1,2,3] | - |
uri?oslc.where=status="%APPR%" | like "%APPR%", aceita também "APPR%" e "%APPR" |
uri?oslc.where=status="*" | status is not null |
uri?oslc.where=status!="*" | status is null |
uri?oslc.where=usewith="INTEGRATION" | - |
ACTIONS
Key | Description |
---|---|
uri/<os>/{id}?action=wsmethod:changeStatus |
Chama actions. Exemplo: POST /maximo/oslc/os/mxasset/{id}?action=wsmethod:changeStatus { "rollToAllChildren": true, "removeFromActiveSP": true, "removeFromActiveRoutes": true, "status": "string", "changePMStatus": true } |
uri/<os>/{id}?action=workflow:<workflow name> |
This invokes the named workflow in the context of the MBO that is identified in the URI. POST uri/<os>/{id}?action=workflow:<workflow name> X-method-override: PATCH |
Response Data
{ "members": [{ "href": "uri" } ... ], "responseInfo": { "nextPage": { "href": "next page uri" }, "href": "request uri", "pagenum": 1 } }