Issue with consuming a REST service of type multipart/mixed
Trying to consume a REST API of type mutlipart/mixed with a file and JSON. Followed the below steps outlined in support articles but service throws the error "UNSUPPORTED_MEDIA_TYPE". This is mainly because Pega setting the content-type header by default as "multipart/form-data" even though mentioning as "multipart/mixed" in Connect REST rule. Anyway to overcome this?
1) Create pyRequestAttachmentPage page
2) Add values for pyAttachNames, pyAttachTypes, pyAttachValues, pyAttachFileNames
Unsupported Media Type response code may come if the server refuses to accept the request because it is in unsupported format. Can you check the Content-Type or Content-Encoding? Please refer to the below articles.
Thanks for the response Rachit. Yes, the problem is with content-type header. I can see the same error from postman too when hitting it as multipart/form-data. Service expects that to be multipart/mixed.
pyAttachTypes value list referring to the content type of the corresponding part of multipart request like application/json, application/pdf, etc. The content type of 'multipart/mixed' i'm referring need to be set at the top header level.