Skip to content

Instantly share code, notes, and snippets.

@joncode
Created October 26, 2012 01:59
Show Gist options
  • Select an option

  • Save joncode/3956523 to your computer and use it in GitHub Desktop.

Select an option

Save joncode/3956523 to your computer and use it in GitHub Desktop.
CURL commands
test the drinkboard menu route :
sending a POST command with an id only
curl http://drinkboard.herokuapp.com/app/menu.json -d 40
send a POST command with the remember token in the params
curl http://localhost:3000/app/providers.json -d "token=vaRlsrT-JjQRkbAhtN27-w"
example of multiple data route
curl http://example.com/users -d"first_name=Bruce&last_name=Wayne"
from rails console
system ("/usr/bin/curl http://0.0.0.0.:3000/app/providers.json -d'token=vaRlsrT-JjQRkbAhtN27-w'")
to see if response exists
to get response in data from json
s = String.new(%x{curl http://0.0.0.0.:3000/app/providers.json -d'token=vaRlsrT-JjQRkbAhtN27-w'})
response = JSON.parse s
VIOLA!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment