Question
Multipart Connect-Rest post request
Hi,
For one of our requirement, we need to send zip files to client along with json data in Connect-Rest post request. Below is the request format we need to send
metadata:
body:
{
"personId":"personId",
"documentType":"DISPUTES",
"documentTitle":"response",
"description":"blah blah",
"caseId":"pega",
"agentUserId":"name of the agent that uploads the document",
"inboundChannel":"NETWORK"
}
file:
For json data, I have created the data transform and mapping the request and for file data I am setting properties ".pyAttachNames to file, .pyAttachTypes to zip, .pyAttachValues to attach stream and .pyAttachFileNames to actual filename with extension" in pyRequestAttachmentPage.
In Connect-Rest rule post method, I am mapping request from clipboard property .request.body_POST, however i am getting 400 bad request error when the rest rule is invoked. When i checked log after setting loggers i can see below messages
Adding outbound message data to the POST request
Request attachment page detected. Attemtping to construct multipart message.
Multipart request message has been constructed.
Request message size is 24850 bytes.
HTTP Status code: 400 Bad Request
It would be helpful if anyone knows how to debug and correct the issue.
400 means the server doesn't understand the request. You'll want to look at the exact request Pega's actually sending to figure out if something is wrong with the request, and if so what. If you're in Pega 7.3.1+ you can use these loggers, set to DEBUG, to log it to the RULES log: httpclient.wire.content and httpclient.wire.header . If you're on an earlier version you'll need to take a network trace with something like TCPMon.
If the output is what you're expecting, it's an issue at the endpoint. If it's not, post the log snippet with the actual request here and I'll try to take a look.