Layer7 API Management

 View Only
  • 1.  Extract binary attachment

    Posted Jun 14, 2016 07:05 AM

    Hi Folks,

                     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 "data=@download.jpg" -F "data=@sample.xml" 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-

    • - 8783
    • - 88
    • -
    • -
    • - image/jpeg
    • - application/octet-stream




    Abhishek Subramanya

  • 2.  Re: Extract MIME attachment

    Posted Jun 16, 2016 04:12 AM

    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.





  • 3.  Re: Extract binary attachment
    Best Answer

    Broadcom Employee
    Posted Jun 20, 2016 02:21 AM

    Hello, is for textual content, for bin data, try

    for more detail, please refer to,

    Message Layer Context Variables - CA API Gateway - 9.1 - CA Technologies Documentation






  • 4.  Re: Extract binary attachment

    Posted Jun 20, 2016 06:38 AM

    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?




  • 5.  Re: Extract binary attachment

    Broadcom Employee
    Posted Jun 21, 2016 01:06 AM

    as per the MIME format, yes.

    try ${}

  • 6.  RE: Re: Extract binary attachment

    Posted Aug 14, 2019 01:17 AM
    Guys anybody some info, on how to read the content of attachment in layer 7

  • 7.  Re: Extract binary attachment

    Posted Jun 21, 2016 03:22 AM

    Thanks again.  We got the file names with the above variable