anypoint-studioapikit

Mulesoft download zip file via APIKit Router


I am having trouble with browser showing save/download prompt for zip file on http endpoint wiht APIKit Router.

I have a sub flow that gets S3 object and sets payload to #[message.payload.getObjectContent] which works fine with http listener going straight to flow, but if using APIKit router browser returns nothing.

I think it might have something to do with my raml.

/GetPackage
  get:
    responses:
      200:
        description: Success
        body:
          200:
            application/zip

I also read something about...

Content-Disposition: attachment;filename=file.zip

Some help/direction would be much appreciated

Tnx!


Solution

  • Figured out a solution. It wasn't enough just having application/zip in RAML.

    Needed to set two properties in Flow (with Property component):

    Content-Disposition: attachment;filename=filename.zip
    Content-Type: application/zip
    

    Configuration XML that I used:

    <set-property propertyName="Content-Disposition" value="attachment;filename=filename.zip" doc:name="Content-Disposition"/>
    <set-property propertyName="Content-Type" value="application/zip" doc:name="Content-Type"/>