noufalbabu
3/22/2018 - 2:23 PM

CURL Basics

Intro from traversy

JSON For testing
  http://jsonplaceholder.typicode.com/
  
Getting all the post
  curl http://jsonplaceholder.typicode.com/posts
  
Getting specified post
  curl http://jsonplaceholder.typicode.com/posts/3
  
Getting specified post and its header
  curl -i http://jsonplaceholder.typicode.com/posts/3

Getting just header
  curl -I http://jsonplaceholder.typicode.com/posts/3
  
Getting all the post and save as test
  curl -o test.txt http://jsonplaceholder.typicode.com/posts
  
Download all the post
  curl -O test.txt http://jsonplaceholder.typicode.com/posts
  
POST data (also we can use --data)
    curl -d "title=Hello&body=Hello World" https://jsonplaceholder.typicode.com/posts
    
PUT Data
    curl -X PUT -d "title=Hello&body=Hello World" https://jsonplaceholder.typicode.com/posts/3
    
DELETE DATA
    curl -X DELETE https://jsonplaceholder.typicode.com/posts/4