Skip to content

Instantly share code, notes, and snippets.

@karlpokus
Last active December 14, 2016 13:43
Show Gist options
  • Save karlpokus/a2198c575a7a368d0bb26a08bbf876f0 to your computer and use it in GitHub Desktop.
Save karlpokus/a2198c575a7a368d0bb26a08bbf876f0 to your computer and use it in GitHub Desktop.
bash curl API
#!/bin/bash
# simple GET
curl <url>
# POST w json
curl -X POST -H "Content-Type: application/json" -d '{"data":"POST with json"}' <url>
# POST w urlencoded
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'foo=1&boo=2' <url>
# curl file
curl -F filedata=@<filename> <url>
# curl file w header
curl -F filedata=@<filename> -H "Content-Type: multipart/form-data" <url>
# to curl @cloud9
# set application link to public under share
# https://community.c9.io/t/run-curl-request-uppon-a-node-js-server/8047/2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment