Skip to content

Instantly share code, notes, and snippets.

@jayeshcp
Created August 25, 2016 00:06
Show Gist options
  • Save jayeshcp/cee841410c9b2d71467d993592129e23 to your computer and use it in GitHub Desktop.
Save jayeshcp/cee841410c9b2d71467d993592129e23 to your computer and use it in GitHub Desktop.
Notes

REST Requests using curl

GET:

curl 
  -X "GET" 
  http://localhost:3000/api

POST:

curl 
  -H "Content-Type: application/json" 
  -X "POST" 
  -d '{"post":"new item through post json curl", "tags" : ["classes","study"]}' 
  http://localhost:3000/api`

PUT:

curl 
  -H "Content-Type: application/json" 
  -X "PUT" 
  -d '{"post":"new updated post", "tags" : ["newtag","anothernewtag"]}' 
  http://localhost:3000/api/57be32e2ad4e708f128322dc`

DELETE:

curl 
  -X "DELETE" 
  http://localhost:3000/api/3000/api/57be32e2ad4e708f128322dc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment