Skip to content

Instantly share code, notes, and snippets.

@stewones
Last active August 29, 2015 14:09
Show Gist options
  • Save stewones/ea91ce030c3cc0ded5cf to your computer and use it in GitHub Desktop.
Save stewones/ea91ce030c3cc0ded5cf to your computer and use it in GitHub Desktop.
esbox api curl workflow
#1 - take the api_token
curl -u fulano@email:senha -X GET http://localhost:8000/v1/
#response json
#{
# "user": {
# "id": "1",
# "email": "fulano@email.com",
# "activated": true,
# "activated_at": null,
# "last_login": "2014-11-14 16:36:07",
# "first_name": "Fulano",
# "last_name": "da Silva",
# "created_at": "2014-11-14 16:34:09",
# "updated_at": "2014-11-14 16:36:07"
# },
# "token": {
# "id": "1",
# "user_id": "1",
# "api_token": "14fe9de1bbc84dd16acc21af46b908450a7811d00709f9fdc78b404254081e29",
# "expires_on": "2014-12-14 16:36:07",
# "client": "||1|1|cURL||||HiSoRange Generic OS||||||||1",
# "created_at": "2014-11-14 16:36:07",
# "updated_at": "2014-11-14 16:36:07"
# }
#}
#2 - use the api_token in header to do requests on the api
curl -X GET -H "X-Auth-Token:api_token" http://localhost:8000/v1/quotes
curl -X GET -H "X-Auth-Token:api_token" http://localhost:8000/v1/quotes > result.json
#response json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment