#Some curl
sample commands in sample application
##Gett a cookie.
$ curl http://localhost:3000/users/new --cookie-jar "cookie.txt"
after this command, you will see a authenticity_token
, please remember it.
##Sign Up
$ curl http://localhost:3000/users --request POST --data "authenticity_token=NCRWZ8JuQs6AFsQg9tw0TP26LyPAnG/ashI0iyMCF8w=" --cookie "cookie.txt" –data “user[name]=kien” --data "user[email][email protected]" --data "user[password]=foobar" --data "user[password_confirmation]=foobar"
##Sign_in
$ curl http://localhost:3000/sessions --request POST --data "authenticity_token=NCRWZ8JuQs6AFsQg9tw0TP26LyPAnG/ashI0iyMCF8w=" --cookie-jar “cookie.txt” --cookie "cookie.txt" --data "session[email][email protected]" --data "session[password]=foobar"
##Update User
$ curl http://localhost:3000/users/2 --request PUT --data "authenticity_token=NCRWZ8JuQs6AFsQg9tw0TP26LyPAnG/ashI0iyMCF8w=" --cookie "cookie.txt" --data "user[email][email protected]" --data "user[name]=Kien Bui"
##Sign Out
curl http://localhost:3000/signout --request DELETE --data-urlencode "authenticity_token=nGFGBMJfg3xN7dR/zDDsTuHtP7e8szod57BFvB7D+5I=" --cookie-jar "cookie.txt" --cookie "cookie.txt"
##Create new post
$ curl http://localhost:3000/microposts --request POST --cookie-jar "cookie.txt" --cookie "cookie.txt" --data-urlencode "authenticity_token=nGFGBMJfg3xN7dR/zDDsTuHtP7e8szod57BFvB7D+5I=" --data "micropost[content]=cURL Test" --data "micropost[user_id]=2"
##Delete a post
$ curl http://localhost:3000/microposts/2 --request DELETE --data-urlencode "authenticity_token=nGFGBMJfg3xN7dR/zDDsTuHtP7e8szod57BFvB7D+5I=" --cookie-jar "cookie.txt" --cookie "cookie.txt"
##Follow user
$ curl http://localhost:3000/relationships --request POST --data-urlencode "authenticity_token=nGFGBMJfg3xN7dR/zDDsTuHtP7e8szod57BFvB7D+5I=" --cookie-jar "cookie.txt" --cookie "cookie.txt" --data "relationship[followed_id]=1"
##Unfollow user
$ curl http://localhost:3000/relationships/1 --request DELETE --data-urlencode "authenticity_token=nGFGBMJfg3xN7dR/zDDsTuHtP7e8szod57BFvB7D+5I=" --cookie-jar "cookie.txt" --cookie "cookie.txt"