Skip to content

Instantly share code, notes, and snippets.

@imobachgs
Last active March 20, 2024 15:47
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 imobachgs/9e300c73464ec809e5c18c7d547327e1 to your computer and use it in GitHub Desktop.
Save imobachgs/9e300c73464ec809e5c18c7d547327e1 to your computer and use it in GitHub Desktop.
Shell scripts to test the Agama HTTP API
TOKEN=$(curl --silent http://localhost:3000/api/auth -d '{"password": "your-password"}' \
-H "Content-Type: application/json" | jq .token | tr -d '"')
echo $TOKEN
echo "Content-Type: application/json" >headers.txt
echo -n "Authorization: Bearer " >>headers.txt
echo $TOKEN >>headers.txt
curl --silent -H @headers.txt \
http://localhost:3000/api/software/products | jq
curl --silent -H @headers.txt -X PUT \
http://localhost:3000/software/config \
-d '{"product": "Tumbleweed"}'
TOKEN=$(curl --silent http://localhost:3000/api/auth -d '{"password": "yhour-password"}' \
-H "Content-Type: application/json" | jq .token | tr -d '"')
echo $TOKEN
websocat ws://192.168.122.10:3000/api/ws -H "Authorization: Bearer $TOKEN"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment