Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

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

  1. Create a Connect-REST instance.
  2. Add the required headers.
  3. Add the file stream in Message Data.
    Get JSON response.


Resolution



To send file attachments in the REST request, complete the following steps:
  1. 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.
  2. Specify the following properties:
    pyRequestAttachmentPage.pyAttachValues(1) = Base64Encode(<Your_text_data>)
    pyRequestAttachmentPage.pyAttachNames(1) = any_name_including _extension

    pyRequestAttachmentPage.pyAttachTypes(1) = TheMIMEType
  3. In next Step, use the Connect-Rest method.


Published March 15, 2018 - Updated October 8, 2020

Was this useful?

100% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us