If you're trying to create the SR and add attachments in a single request, you need to use the base64 encoded content. The documentdata field has always depended on the file contents being sent as base64 encoded and that's how we support it in a single request. This is what I would recommend as it's the more heavily used of the two.
If you make it as a separate request, we support sending the file contents as binary. We cover this approach in the Maximo REST API Guide (which you can get the link to the latest version here https://community.ibm.com/community/user/asset-facilities/viewdocument/maximos-rest-api-aka-json-api-os?CommunityKey=ed77c224-45e2-47b0-b574-cc31496f9a41&tab=librarydocuments).
Essentially, you make a POST request to the URL of the record like:
/maximo/api/os/mxapiwodetail/_QkVERk9SRC8xMDAx/doclinks?lean=1
And then provide headers for slug (filename), content-type (the type of file of course), and x-document-meta (the doctype you want the attachment associated with). Then the body is the binary contents of the file.
------------------------------
Steven Shull
------------------------------
Original Message:
Sent: Mon May 01, 2023 01:49 AM
From: Bibin Philip
Subject: Does maximo accept binary content as attachments
We are trying to create a service request via API from a third party application.
Attachments seems to be working when we are using base64 encoded content. But while passing the attachment content as binary content, the attachment content seems to be corrupted.
Does Maximo support binary content? If so, is there any steps needed to be configured for accepting binary content?
------------------------------
Bibin Philip
------------------------------