Search This Blog

Wednesday, August 21, 2019

MAXIMO: Upload attachments using REST API

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

5 comments:

Pankaj said...

This is good article on loading attachments via REST API.

AndrewT said...

Hi, usefull article. unfortunately the links to your blog don't work !! Is it possible to consult them elsewhere?
Thankz

VVR said...

Hi,
I am using the REST API to create work orders. Using this, how can we upload attachments?

http://maximo.xyz.com:9080/maxrest/rest/mbo/workorder

Andre Ramirez Cordeiro said...

Good stuff...congrats
Do you know if it is possible to indicate the path to the file to be inserted?
Thanks

quantumstrides said...

Thanks for sharing this information with us and it was a nice blog. Are you searching for Integrated Workplace Management System
IBM Maximo
Cybersecurity Practice Areas
AI and Automation