Files
wlan-cloud-ucentralgw/test_scripts/curl/do_request.sh
2021-04-11 16:10:23 -07:00

26 lines
589 B
Bash
Executable File

#!/bin/bash
if [ $# -eq 0 ]; then
if [ "$test_device" = "" ]; then
echo "You must supply the serial number of device to test or set <test_device> to the serial number you want to test."
exit 1
else
serial=$test_device
fi
else
serial=$1
fi
payload="{ \"serialNumber\" : \"$serial\" , \"message\" : \"state\" }"
echo $payload
webtoken=`./login.sh | jq -r '.access_token'`
curl -X POST \
-H "accept: application/json" \
-H "Authorization: Bearer $webtoken" \
--insecure -d "$payload" \
"https://localhost:16001/api/v1/device/$serial/request"