Thursday 20 February 2020

IBM MAXIMO : UPLOAD DOCKLINKS ATTACHMENTS USING REST API


In this post I will explain in details how to upload attachments to Maximo record using REST API.


I will be using Work Order to explain this use case.

First step is to configure Object Strcture having required objects as in this case WorkOrder and DOCLINK

I have created Object Strcture as below :

Object Structure : RESTWODOCLINKS
Description : Upload WO Attachment using REST API

Its consumed by Integration and includes Workorder and DOCLINKS objects.















Next step is to configure security for Object Structure to grant access to specific groups which is being used by REST API call user. 
You can refer my other post IBM Maximo REST API Example - Change Person/User/Labor status for the same.
maximo REST api













maximo rest api











If you miss to configure object structure for respective group you might get error like below :




Next we are going to submit REST request , I will be using Postman client for the same and detailed explanation of postman parameters and rest/oslc URLs is explained in my post here @  IBM Maximo REST API Example - Change Person/User/Labor status .

I have  created sample RESTTEST Workorder to be used in this example.
This record can be fetched with REST URI as below  sample URI format is
http://host:port/maximo/oslc/os/RESTWODOCLINKS/_QkVERk9SRC9SRVNUVEVTVA--?lean=1
maximo rest api













Now I am going POST REST call using Postman client.

I am using sample JSON paylod as below to upload attachment against Workorder :

Postman sample POST request URL is  http://host:port/maximo/oslc/os/RESTWODOCLINKS/_QkVERk9SRC9SRVNUVEVTVA--?lean=1

{
"wonum": "RESTTEST",
"siteid": "BEDFORD",
"orgid": "EAGLENA",

"doclinks":[
{
    "ADDINFO": "1",
     "COPYLINKTOWO": "0",
     "DESCRIPTION": "Example Attachment via REST API",
"DOCUMENT": "Test via Rest API",
"OWNERTABLE": "WORKORDER",
"UPLOAD": "1",
"NEWURLNAME": "www.ibm.com",
     "urltype":"FILE",
     "documentdata":"aGV5IGhvdyBhcmUgeW91",
     "doctype":"Attachments",
     "urlname":"SampleREST-Upload.txt",
     "OWNERID" : "133634"
}
]
}

maximo rest api










This POST request then successfully adds Attachment against workorder :

maximo rest api










If you want to achieve same thing using Web Service you can refer IBM blog @ IBM Maximo: Iimport attachments into MAXIMO using MIF Web Services.

Additionally IBM REST API Guide can be referred @ IBM Maximo REST API Guide

No comments:

Post a Comment

IBM Readme for IBM Maximo Asset Management 7.6.1.3 Fix Pack

  Fix Readme Abstract This fix pack updates IBM® Maximo® Asset Management version 7.6.1, 7.6.1.1, and 7.6.1.2 Content IBM Maximo Asset Manag...