Question
CSAA
US
Last activity: 24 Jan 2024 12:51 EST
Connect-Rest Integration with multipart/mixed
Hi
I need to integrate with a multipart/mixed REST service in Pega. Can anyone share me the procedure on how to achieve this and what are all needs to be set in the headers and request?
(“Content-Type”,“multipart/mixed; boundary=\“---Content Boundary\“”)
Thanks
Naveen
-
Likes (1)
Ratna Rajesh Appari -
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Updated: 24 Jan 2024 12:51 EST
Pegasystems Inc.
CA
We don't support multipart/mixed OOTB. We only support multipart/form-data via the use of pyRequestAttachmentPage.
If you do want to work with a scenario specific to multipart/mixed, then you can use REST connector to construct such a request. These are the changes you need to make:
1) First, understand how multipart works. Read this: https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html
2) In REST Connector POST request header, set Content-Type to multipart/mixed;boundary=<enter any set of alphanumeric chars here>, say multipart/mixed;boundary=abc
3) Manually construct the POST request body as below and set the entire value to a string property, say, pyNote:
--abc
Content-Type: application/json
<blank line here>
<your JSON body goes here>
<blank line here>
--abc--
4) In REST Connector POST Message Data section, select Map from as Clipboard and Map from key as .pyNote.
In the above example, "abc" is used as boundary separator between each "part". You just need to construct one part for your requirement.
******** Edited by Moderator Marije to add recommended documentation *********
The above solution is specifically aimed for unsupported multipart/mixed scenario.
We don't support multipart/mixed OOTB. We only support multipart/form-data via the use of pyRequestAttachmentPage.
If you do want to work with a scenario specific to multipart/mixed, then you can use REST connector to construct such a request. These are the changes you need to make:
1) First, understand how multipart works. Read this: https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html
2) In REST Connector POST request header, set Content-Type to multipart/mixed;boundary=<enter any set of alphanumeric chars here>, say multipart/mixed;boundary=abc
3) Manually construct the POST request body as below and set the entire value to a string property, say, pyNote:
--abc
Content-Type: application/json
<blank line here>
<your JSON body goes here>
<blank line here>
--abc--
4) In REST Connector POST Message Data section, select Map from as Clipboard and Map from key as .pyNote.
In the above example, "abc" is used as boundary separator between each "part". You just need to construct one part for your requirement.
******** Edited by Moderator Marije to add recommended documentation *********
The above solution is specifically aimed for unsupported multipart/mixed scenario.
The content type "multipart/form-data" should be used for submitting forms that contain files, non-ASCII data, and binary data.
For the latest documentation on implementing a generic use case to send attachment through connect Rest rule please check the following:
File attachment configuration in REST and SOAP integrations
Use case: Send file attachments from a repository
Mapping the data for a POST response for a Connect REST rule
*******************************************************************************************
Pegasystems Inc.
CA
Can you elaborate on the requirement? Do you want to construct a multipart request or parse a multipart response? Are you using Pega REST connector or service?
CSAA
US
Hi Praneeth
Our requirement is a Connector. We need to connect with a multipart/mixed REST API which accepts json request as well as a file. Our requirement is to update only the json part and we would not send any file in the request. We formed the json request in the body and not getting any success. Any mandatory properties that need to be set while integrating with this kind of multipart APIs. I gave the header as multipart/mixed; boundary=---Content Boundary(as given by the API team) in the Content-Type header in the connector rule.
Thanks in Advance
Naveen
Accepted Solution
Updated: 24 Jan 2024 12:51 EST
Pegasystems Inc.
CA
We don't support multipart/mixed OOTB. We only support multipart/form-data via the use of pyRequestAttachmentPage.
If you do want to work with a scenario specific to multipart/mixed, then you can use REST connector to construct such a request. These are the changes you need to make:
1) First, understand how multipart works. Read this: https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html
2) In REST Connector POST request header, set Content-Type to multipart/mixed;boundary=<enter any set of alphanumeric chars here>, say multipart/mixed;boundary=abc
3) Manually construct the POST request body as below and set the entire value to a string property, say, pyNote:
--abc
Content-Type: application/json
<blank line here>
<your JSON body goes here>
<blank line here>
--abc--
4) In REST Connector POST Message Data section, select Map from as Clipboard and Map from key as .pyNote.
In the above example, "abc" is used as boundary separator between each "part". You just need to construct one part for your requirement.
******** Edited by Moderator Marije to add recommended documentation *********
The above solution is specifically aimed for unsupported multipart/mixed scenario.
We don't support multipart/mixed OOTB. We only support multipart/form-data via the use of pyRequestAttachmentPage.
If you do want to work with a scenario specific to multipart/mixed, then you can use REST connector to construct such a request. These are the changes you need to make:
1) First, understand how multipart works. Read this: https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html
2) In REST Connector POST request header, set Content-Type to multipart/mixed;boundary=<enter any set of alphanumeric chars here>, say multipart/mixed;boundary=abc
3) Manually construct the POST request body as below and set the entire value to a string property, say, pyNote:
--abc
Content-Type: application/json
<blank line here>
<your JSON body goes here>
<blank line here>
--abc--
4) In REST Connector POST Message Data section, select Map from as Clipboard and Map from key as .pyNote.
In the above example, "abc" is used as boundary separator between each "part". You just need to construct one part for your requirement.
******** Edited by Moderator Marije to add recommended documentation *********
The above solution is specifically aimed for unsupported multipart/mixed scenario.
The content type "multipart/form-data" should be used for submitting forms that contain files, non-ASCII data, and binary data.
For the latest documentation on implementing a generic use case to send attachment through connect Rest rule please check the following:
File attachment configuration in REST and SOAP integrations
Use case: Send file attachments from a repository
Mapping the data for a POST response for a Connect REST rule
*******************************************************************************************
-
Ratna Rajesh Appari
Pegasystems Inc.
FR
Have you looked into this conversation maybe: https://collaborate.pega.com/question/how-pass-file-and-metadata-form-data-connect-rest-post-method-body
-
Naveen Raja Chavadipalayam Balamuruhan Minavathi