How to download attachment from Postman Response

Archit Goyal picture Archit Goyal · Jun 22, 2018 · Viewed 13.8k times · Source

I have a API which sends response having following header:

Headers(8)
Test Results(1/1)
Status:200 OK
Time:5890 ms
Size:1.24 MB
Access-Control-Allow-Origin →*
Cache-Control →no-cache
Content-Disposition →attachment; filename=Report.csv
Content-Length →1298149
Content-Type →text/csv
Date →Fri, 22 Jun 2018 08:50:05 GMT
Expires →-1
Pragma →no-cache

I want to download the attachment file 'Report.Csv'

Can anyone suggest How can I do it via script or newman

Answer

J.Lin picture J.Lin · Jun 28, 2018

If you're sending a request from within the Postman app, you can "Send and download" the response.

...you should select “Send and download” which will let you save the response to your hard disk.

If you're trying to do it by script, here's a tutorial about writing to your local file system by running a local server, or how to use Newman to do something similar.