Skip to content

Instantly share code, notes, and snippets.

@mchugh19
Last active March 23, 2016 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mchugh19/b7a5084c3a5395bf03ac to your computer and use it in GitHub Desktop.
Save mchugh19/b7a5084c3a5395bf03ac to your computer and use it in GitHub Desktop.
#!/bin/sh
JSON='[{"arg": "docker", "client": "local","expr_form": "glob","fun": "state.sls","tgt": "SOMEHOST", "kwarg": ["test": "True"] }]'
RESPONSE=`curl -ik https://localhost:8000/login -H 'Content-Type: application/json' -d '[{"eauth":"pam","password":"PASSWORD","username":"USERNAME"}]' 2>/dev/null`
TOKEN=`echo $RESPONSE | grep -oP "[[:alnum:]]{40}" | uniq`
RESPONSE=`curl -k https://localhost:8000/ -H 'Accept: application/json' -H "X-Auth-Token: $TOKEN" -H 'Content-Type: application/json' -d "$JSON" 2>/dev/null`
echo $RESPONSE | tr '\n' ' '
echo ""
echo $RESPONSE | tr '\n' ' ' | python -m json.tool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment