I need to submit a file and a few text properties to an API(Form-Data), when i am using Postman it is working fine. But now in Pega, I have to implement this, so far i have implemented Rest connectors to send data in JSON format help me to implement Form-data(Multipart) using pega. tried things availble from pdn. didnt work.
To implement Form Data (Multipart) in Pega you can follow these steps: 1. Create a Button for File Upload: Create a button in the actions tab and configure an event on click to perform the following in sequence: Call Local Action pyAttachContent Set the value of .pyAttachmentType to File Call an activity Refresh the harness 2. Configure the Activity: In the activity open the attachment through the key pyAttachments(n).pxLinkedRefTo property (present in pyWorkPage ) in a page of class Data WorkAttach File (e.g. SampleFile ). Then create a page pyRequestAttachmentPage of class Data ServiceMessage and set the following parameters: pyAttachNames(n) : This contains the parameter to be passed (e.g. name file etc.) pyAttachTypes(n) : This contains the content type (e.g. application/json etc.). This should NOT be set to multipart/formdata pyAttachValues(n) : This contains the actual file data 3. Set Metadata: For metadata set the required data to one property and send it in the request through the body of the Connect REST rule. If you encounter issues try passing metadata in the query string instead of the body. 4. Test the Configuration: Ensure that the file and metadata are correctly passed to the service by testing the configuration. For more detailed guidance you can refer to the following resources: [How to send file as Form data to Connect REST API](How to add an extra key values in Pega class? | Support Center send file form data connect rest api) [How to pass a file and metadata as form data in Connect REST post method body](How to add an extra key values in Pega class? | Support Center pass file and metadata form data connect rest post method body)
This is a GenAI-powered tool. All generated answers require validation against the provided references.
How to pass a file and metadata as form-data in Connect-REST post method body