Support Article
Cannot send file to REST Service
SA-2586
Summary
How can I connect to a REST service and send a file to the REST Service?
Error Messages
Not Applicable
Steps to Reproduce
- Create a Connect-REST instance.
- Add the required headers.
- Add the file stream in Message Data.
Get JSON response.
Resolution
To send file attachments in the REST request, complete the following steps:
- Create a page with the name pyRequestAttachmentPage of class Data-ServiceMessage.
Each Part in the MIME multipart should have its type set using the pyAttachTypes property on the Attachment page. - Specify the following properties:
pyRequestAttachmentPage.pyAttachValues(1) = Base64Encode(<Your_text_data>)
pyRequestAttachmentPage.pyAttachNames(1) = any_name_including _extension
pyRequestAttachmentPage.pyAttachTypes(1) = TheMIMEType - In next Step, use the Connect-Rest method.
Published March 15, 2018 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.