Solved

OData upload attachment "Error occurred while reading binary data"

  • 2 July 2021
  • 6 replies
  • 358 views

Userlevel 4
Badge +4

trying to add an attachment via OData in a test environment with FSM6u6. I have encoded the binary file with base64 but I cannot seem to upload the file

URL - http://fsmURL//odata/attachment

parameter - 

{
   "attachment@odata.mediaEditLink":"encoded the binary file with base64",
   "attachment_name":"testtwo.jpg",
   "file_type":"image/jpeg"

}

refer the attach image for the output.

is it possible to attach encoded the binary file with base64 in FSM using the above mentioned API?

 

icon

Best answer by Jon Reid 7 July 2021, 22:11

View original

6 replies

Userlevel 4
Badge +4

Tagging #IFSACH #ACHTECH
CC: @Yasas Kasthuriarachchi

Userlevel 7
Badge +30

HI @Lee Pinchbeck could you please check on the above since it relates to FSM.
Thanks & Best Regards,
Yasas

Userlevel 7
Badge +24

Hi @Kajendran Chandreswaran,

I have not seen base64 given as an accepted format but I have passed this to R&D for them to give a definitive answer on this.

Kind regards,

Lee Pinchbeck

Userlevel 6
Badge +17

See “WORKING WITH ATTACHMENTS AND IMAGES” starting on page 30 of the FSM6 OData REST APIs document (Help->Documentation->Integrations->FSM6 OData REST APIs.   Especially keep in mind “Note that the file/url must be accessible to the FSM server” as mentioned on page 32.

Userlevel 1
Badge +3

To upload binary data through OData service, we need to save the file in a location where OData service has access to read the file.

 

URL specified in attachment@odata.mediaEditLink should be accessible from the OData service.

 

E.g.

As a file URL.

POST http://<servername>/<fsmserver>/odata/attachment

{
"attachment@odata.mediaEditLink": "file://mkepde64/M5Attachments/626175160.jpg",
"attachment_id": 1209,
"attachment_name": "uploaded through odata",
"file_type": "image/jpeg"
}

 

As a URL.

POST http://<servername>/<fsmserver>/odata/attachment

{

"attachment@odata.mediaEditLink": "https://fsmdev64-rnd.ifsworld.com/uploads/dell_install_guide.pdf",

"attachment_name": "Attachment created through OData",

"file_type": "application/pdf"

}

 

When creating an attachment with an OData service hosted in Azure, we can use a fileshare created in the storage account associated with FSM server.

 

POST https://fsm6qa.fsm.ifsdevworld.com/odata/attachment

Body
{
"attachment@odata.mediaEditLink": "fsmshare/inbound/exceptions/000freezer.jpg",
"attachment_name": "FSMZ-2916 OData upload",
"file_type": "image/jpeg"
}

Userlevel 4
Badge +4

thank you for the information @sachinthaw and @Jon Reid

 

so is it possible to upload the attachment in base 64 format?

is there any acceptable encryption format that can be used for uploading attachment?

Reply