IBM Maximo: Dicas de APIs Rest: Difference between revisions
Line 52: | Line 52: | ||
'''Request (Python)''' | '''Request (Python)''' | ||
import requests | <nowiki>import requests | ||
url = "https://mx.com/maximo/oslc/os/MXOBJECTCFG" | url = "https://mx.com/maximo/oslc/os/MXOBJECTCFG" | ||
Line 69: | Line 69: | ||
response = requests.request("GET", url, headers=headers, params=querystring) | response = requests.request("GET", url, headers=headers, params=querystring) | ||
print(response.text) | print(response.text)</nowiki> | ||
* Traz apenas parte dos atributos: oslc.select=objectname,rel.maxattributecfg{attributename,maxtype,primarykeycolseq,required,title} | * Traz apenas parte dos atributos: oslc.select=objectname,rel.maxattributecfg{attributename,maxtype,primarykeycolseq,required,title} |
Revision as of 20:17, 8 December 2021
Documento em Rascunho (Draft)
URLs
Getting the list of Object Structures
Request
curl -X GET '/maximo/oslc/os/MXINTOBJECT?lean=1&oslc.select=intobjectname,description,rel.maxintobjdetail{objectname,hierarchypath}&oslc.pageSize=1001&oslc.where=usewith%3D%22INTEGRATION%22' \ -H 'Accept: application/json' \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/json' \ -H 'maxauth: <CHANGE_HERE>'
- Traz apenas parte dos atributos: oslc.select=intobjectname,description,rel.maxintobjdetail{objectname,hierarchypath}
- Define a seleção com oslc.where=usewith="INTEGRATION"
Response
{ "member": [ { "_rowstamp": "1401947183", "maxintobjdetail_collectionref": "https://mx.com/maximo/oslc/os/mxintobject/_TVhJTlZFTlRPUlk-/maxintobjdetail", "description": "Definição de Blablabla", "maxintobjapp_collectionref": "https://mx.com/maximo/oslc/os/mxintobject/_TVhJTlZFTlRPUlk-/maxintobjapp", "maxintobjdetail": [ { "hierarchypath": "WORKORDER", "objectname": "WORKORDER" }, { "hierarchypath": "WORKORDER/WOACTIVITY", "objectname": "WOACTIVITY" }, ], "href": "https://mx.com/maximo/oslc/os/mxintobject/_TVhJTlZFTlRPUlk-", "intobjectname": "MXWOBLABLA" }, ... ], "href": "https://mx.com/maximo/oslc/os/MXINTOBJECT", "responseInfo": { "href": "https://mx....", "pagenum": 1 } }
Get the attributes of Object Structures
Request (Python)
import requests url = "https://mx.com/maximo/oslc/os/MXOBJECTCFG" querystring = { "lean":"1", "oslc.select":"objectname,rel.maxattributecfg{attributename,maxtype,primarykeycolseq,required,title}", "oslc.pageSize":"1001", "oslc.where":"objectname IN ['WORKORDER','WOACTIVITY']"} headers = { 'maxauth': "<CHANGE_HERE>", 'Content-Type': "application/json", 'Accept': "application/json" } response = requests.request("GET", url, headers=headers, params=querystring) print(response.text)
- Traz apenas parte dos atributos: oslc.select=objectname,rel.maxattributecfg{attributename,maxtype,primarykeycolseq,required,title}
- Define a seleção com oslc.where=objectname IN ["WORKORDER","WOACTIVITY"]'
Response
{ "member": [ { "_rowstamp": "5517901218", "maxattributecfg_collectionref": "https://mx.com/maximo/oslc/os/mxobjectcfg/_V09SS09SREVS/maxattributecfg", "maxattributecfg": [ { "maxtype_description": "Data e Hora", "maxtype": "DATETIME", "attributename": "ACTFINISH", "title": "Término Efetivo", "required": false }, ... ], "objectname": "WORKORDER", "href": "https://mx.com/maximo/oslc/os/mxobjectcfg/_V09SS09SREVS" }, { "_rowstamp": "5517899849", "maxattributecfg_collectionref": "https://mx.com/maximo/oslc/os/mxobjectcfg/_V09BQ1RJVklUWQ--/maxattributecfg", "maxattributecfg": [ { "maxtype_description": "Alfanumérico", "maxtype": "ALN", "attributename": "DESCRIPTION", "title": "Descrição", "required": false }, ... ], "objectname": "WOACTIVITY", "href": "https://mx.com/maximo/oslc/os/mxobjectcfg/_V09BQ1RJVklUWQ--" }, ], "href": "https://mx.com/maximo/oslc/os/MXOBJECTCFG", "responseInfo": { "href": "https://mx.com/maximo/oslc/os/MXOBJECTCFG?lean=1&oslc.select=objectname,rel.maxattributecfg{attributename,maxtype,primarykeycolseq,required,title}&oslc.pageSize=1001&oslc.where=objectname%20IN%20%5B%22WORKORDER%22%2C%22WOACTIVITY%22%5D", "pagenum": 1 } }