Search code examples
curlcommand-line-interfaceparse-server

Write cURL request to .json file


I want to take the response body generated from this request:

curl -X GET \
-H "X-Parse-Application-Id: AppId" \
-H "X-Parse-REST-API-Key: RESTAPIKey" \
https://parseapi.back4app.com/classes/_User

...and output a .json file. How can I do this?


Solution

  • curl -X GET \ -H "X-Parse-Application-Id: AppId" \ -H "X-Parse-REST-API-Key: RESTAPIKey" \ https://parseapi.back4app.com/classes/_User > out.json

    or curl -X GET \ -H "X-Parse-Application-Id: AppId" \ -H "X-Parse-REST-API-Key: RESTAPIKey" \ https://parseapi.back4app.com/classes/_User -o out.json

    Edited to add more info:

    The second is probably nicer because it is entirely cURL though the redirect gives you more options if you did want to run it through another script for formatting reasons. I don't think either option will pretty print the json on their own.