Reputation: 469
I am trying to copy the curl from this website to postman.
I want to copy the request when clicking on the following button:
I opened DevTools in the Network tab to see copy the request:
and then I import to postman:
But in Postman, I get HTML response, while chrome downloads an xls file. Why does Postman fail to download the file? Does anyone see what I am missing?
Upvotes: 2
Views: 5046
Reputation: 111
For me the problem was the carrot new line/option terminator that Chrome adds for each new option. So if you remove the carrots (^ or /) at the end of each line it will work. Make sure there is a space where the new line terminates. Remove the ^ or / and it should be fine. End line terminator could be different depending on the Curl option from Chrome.
For example change (does not import):
curl "https://myapi.restapis.com/insurance/claims/attachment" ^
-H "authority: myapi.restapis.com" ^
-H "accept: application/json, text/plain, */*" ^
-H "accept-language: en-US,en;q=0.9" ^
-H "authorization: Bearer --bearer token etc." ^
-H "content-type: application/json;charset=UTF-8" ^
-H "location-timezone: Eastern Standard Time" ^
-H "origin: ^
https:///apis.restapis.com" ^
-H "timezone: Eastern Standard Time" ^
--compressed
To this (does import):
curl "https://myapi.restapis.com/insurance/claims/attachment"
-H "authority: myapi.restapis.com"
-H "accept: application/json, text/plain, */*"
-H "accept-language: en-US,en;q=0.9"
-H "authorization: Bearer --bearer token etc."
-H "content-type: application/json;charset=UTF-8"
-H "location-timezone: Eastern Standard Time"
-H "origin:
https:///apis.restapis.com"
-H "timezone: Eastern Standard Time"
--compressed
Should be good to import into Postman from Chrome curl.
Upvotes: 1
Reputation: 8322
From whatever reason the body is not copied to Postman request. When I copy it manually from the browser's network tab:
I can get the xml format, then I can click on Save Response => Save to a file, and it offers me to save it as "breach_report.xls".
Upvotes: 3