Last active
May 6, 2024 13:09
-
-
Save imobachgs/9e300c73464ec809e5c18c7d547327e1 to your computer and use it in GitHub Desktop.
Shell scripts to test the Agama HTTP API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/api/software/config \ | |
-d '{"product": "Tumbleweed"}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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