|
|
Line 3: |
Line 3: |
| = URLs = | | = URLs = |
|
| |
|
| == Getting the list of Object Structures==
| |
|
| |
|
| '''Request'''
| | * [IBM Maximo: Get a list of Object Structures using REST API] |
| | * [IBM Maximo: Get the attributes of Object Structures using REST API] |
|
| |
|
| <nowiki>import requests
| |
|
| |
| url = "https://mx.com/maximo/oslc/os/MXINTOBJECT"
| |
|
| |
| querystring = {
| |
| "lean":"1",
| |
| "oslc.select":"intobjectname,description,rel.maxintobjdetail{objectname,hierarchypath}",
| |
| "oslc.pageSize":"1001",
| |
| "oslc.where":"usewith='INTEGRATION'"}
| |
|
| |
| headers = {
| |
| 'maxauth': "<CHANGE_HERE>",
| |
| 'Content-Type': "application/json",
| |
| 'Accept': "application/json"
| |
| }
| |
|
| |
| response = requests.request("GET", url, headers=headers, params=querystring)
| |
| print(response.text)</nowiki>
| |
|
| |
| * Traz apenas parte dos atributos: oslc.select=intobjectname,description,rel.maxintobjdetail{objectname,hierarchypath}
| |
| * Define a seleção com oslc.where=usewith="INTEGRATION"
| |
|
| |
| '''Response'''
| |
|
| |
| <nowiki>{
| |
| "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
| |
| }
| |
| }</nowiki>
| |
|
| |
| == Get the attributes of Object Structures==
| |
|
| |
| '''Request (Python)'''
| |
|
| |
| <nowiki>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)</nowiki>
| |
|
| |
| * 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'''
| |
|
| |
| <nowiki>{
| |
| "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
| |
| }
| |
| }</nowiki>
| |
|
| |
|
| = Ver também = | | = Ver também = |