Skip to content

Instantly share code, notes, and snippets.

@BrianSigafoos
Created August 24, 2017 16:55
Show Gist options
  • Save BrianSigafoos/05220b6cc8c838ef4184805c70ae91f3 to your computer and use it in GitHub Desktop.
Save BrianSigafoos/05220b6cc8c838ef4184805c70ae91f3 to your computer and use it in GitHub Desktop.
curl + REST API

curl testing a REST API

# HEAD request: -I 
$ curl -I  http://0.0.0.0:3000/posts

# -i (--include) protocol headers and -X (--request) for GET, PUT, DELETE
$ curl -i -X HEAD http://0.0.0.0:3000/posts

# prettify JSON results with python -mjson.tool 
$ curl ... | python -mjson.tool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment