I am trying to extract the contents of the attachment in the request, but I am not able to read the attachment data.
Request - I am sending an xml file & a jpg file as attachments.
curl -i -X POST -F "firstname.lastname@example.org" -F "email@example.com" https://<IP>:<port>/test/attachments
I am logging the below context variables in the policy. I am also able to see that gateway has identified that request has 2 attachments . But unable to view the attachment body-
I have an update on the question. I was trying different formats. Here is what I observe -
Request with two xml files as attachments
Gateway is able to extract contents of both attachments. No issues found.
One xml file & another binary JPEG file as attachments
Gateway is able to extract contents of xml only. I am unable to lookup/extract the binary contents in any form.
request.parts.x.body is for textual content, for bin data, try request.parts.x
for more detail, please refer to,
Message Layer Context Variables - CA API Gateway - 9.1 - CA Technologies Documentation
Thanks Zhijun He. We were able extract the mainpart of multipart attachments.
I do have a follow up question regarding the context variables available. I do not see a variable specifying the file name. Should it be separately passed as a multipart header?
as per the MIME format, yes.
Thanks again. We got the file names with the above variable