Skip to content

Instantly share code, notes, and snippets.

@caot
Last active September 15, 2016 20:47
Show Gist options
  • Select an option

  • Save caot/75f04f482bdf05dbb205 to your computer and use it in GitHub Desktop.

Select an option

Save caot/75f04f482bdf05dbb205 to your computer and use it in GitHub Desktop.
jsawk example
HOST=node:port
auth=`curl -X POST -H "Content-Type: application/json" -d '{"username":"xxxx","password":"yyyy"}' http://hostname/ws/auth-token/ | jsawk 'return this.payload.token'`
curl -sw '\n%{http_code}' -H "Authorization: JWT $auth" -X GET http://hostname/ws/users/{pk}/
curl -sw '\n%{http_code}' -X POST -H "Authorization: JWT $auth" -H "Content-Type: application/json" -d '{"date":"2016-05-05 05:52:00","id":1}' http://$HOST/action/
here is more example:
http://blog.xebia.com/2012/06/27/json-shell-scripting-with-jsawk/
http://www.programering.com/q/MjN1EzMwATA.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment