Skip to content

Instantly share code, notes, and snippets.

@nipunthathsara
Created April 23, 2020 20:18
Show Gist options
  • Save nipunthathsara/1b2e14fc49a1cb27e2ba6b5b72948403 to your computer and use it in GitHub Desktop.
Save nipunthathsara/1b2e14fc49a1cb27e2ba6b5b72948403 to your computer and use it in GitHub Desktop.
Shell - Curl with random inputs
while(true)
do
curl -k -v -X POST 'http://192.168.43.173:5000/api/sensor-data' \
--header 'Content-Type: application/json' \
--header 'x-auth-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNTg3NjUxMzEzLCJleHAiOjE1ODc2NTQ5MTN9.JLaDFORUBzIgH58c1BZLKFH6YiHkOEaCcXh015kZtfA' \
--header 'Content-Type: Application/json' \
--data "{\"sensorId\": \"$(( ( RANDOM % 10 ) + 1 ))\", \"co2Level\": \"$(( ( RANDOM % 10 ) + 1 ))\", \"smokeLevel\": \"$(( ( RANDOM % 10 ) + 1 ))\"}"
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment