chore: more requests

This commit is contained in:
Andrey Egorov
2025-09-27 14:27:04 +03:00
parent e178482209
commit 14528b4ceb

31
req.sh
View File

@@ -47,8 +47,29 @@ elif [[ $1 == "devices-serial-with-reg" ]]; then
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" "$ADDR/data/getDevices" | jq ".devices[] | (.SERIAL) +\" -- \"+ (.REG_NUMBER)" | tr -d "\"" curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" "$ADDR/data/getDevices" | jq ".devices[] | (.SERIAL) +\" -- \"+ (.REG_NUMBER)" | tr -d "\""
elif [[ $1 == "devices-status" ]]; then elif [[ $1 == "devices-status" ]]; then
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" "$ADDR/data/getDevices" | jq ".devices[] | (.SERIAL) +\" -- \"+ (.IS_CONNECTED|tostring)+\" -- \"+ (.REG_NUMBER)" | tr -d "\"" curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" "$ADDR/data/getDevices" | jq ".devices[] | (.SERIAL) +\" -- \"+ (.IS_CONNECTED|tostring)+\" -- \"+ (.REG_NUMBER)" | tr -d "\""
elif [[ $1 == "factories" ]]; then elif [[ $1 == "export-backup" ]]; then
curl -X GET -s -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" "$ADDR/data/getFactories" | jq curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" \
-d '{ "startTime": 1758880189, "endTime": 1753024741 }' \
"$ADDR/data/backup/export" --output export.zip
elif [[ $1 == "export-logs" ]]; then
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" \
-d '{ "devices": ["KerbClientEmulat"], "start": 1, "end": 1748442522, "timezone": "GMT+03:00"}' \
"$ADDR/data/logs/exportLogsReport" | jq
elif [[ $1 == "get-from-redis" ]]; then
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" \
"$ADDR/data/getDataFromRedis?fileID=$2"
elif [[ $1 == "alarms-amount" ]]; then
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" \
-d '{ "devices": ["A56AF66F17D902B8"], "start_time": 1757890398, "end_time": 1757892398 }' \
"$ADDR/data/alarms/getAlarmsAmount" | jq
elif [[ $1 == "alarms" ]]; then
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" \
-d '{ "devices": ["A56AF66F17D902B8"], "start_time": 1757890398, "end_time": 1757892398, "page_number": 1, "page_size": 30}' \
"$ADDR/data/alarms/getAlarms" | jq
elif [[ $1 == "sensor-data" ]]; then
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" \
-d "{ \"device\": \"A56AF66F17D902B8\", \"sensor\": \"TEMPERATURE/85\", \"start\": $(($(date +%s)-1000)), \"end\": $(date +%s), \"skip\": 1 }" \
"$ADDR/data/sensors/getDeviceSensorData" | jq
elif [[ $1 == "factory-models" ]]; then elif [[ $1 == "factory-models" ]]; then
if [[ $2 == "" ]]; then if [[ $2 == "" ]]; then
echo "No serial presented" echo "No serial presented"
@@ -80,7 +101,11 @@ elif [[ $1 == "device-params-v2" ]]; then
fi fi
curl -X POST -s -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" -d "{ \"serial\": \"$2\" }" "$ADDR/settings/deviceSettingsV2" | jq curl -X POST -s -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" -d "{ \"serial\": \"$2\" }" "$ADDR/settings/deviceSettingsV2" | jq
elif [[ $1 == "connected-chart" ]]; then elif [[ $1 == "connected-chart" ]]; then
curl -X POST -s -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" -d "{ \"start_time\": 1757850710, \"end_time\": 1757850410 }" "$ADDR/data/getConnectedDevicesChart" | jq curl -X POST -s -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" \
-d "{ \"start_time\": 1757867195, \"end_time\": 1757937195 }" "$ADDR/data/getConnectedDevicesChart" | jq
elif [[ $1 == "connected-chart-v2" ]]; then
curl -X GET -s -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" \
"$ADDR/data/getConnectedDevicesChartV2" | jq
elif [[ $1 == "device-params" ]]; then elif [[ $1 == "device-params" ]]; then
if [[ $2 == "" ]]; then if [[ $2 == "" ]]; then
echo "No serial presented" echo "No serial presented"