I have an Azure Iot Hub endpoint where I have to send some data (consider small strings). I want to set the speed of sending the data to that url and am using Trickle to achieve that.
I thought
trickle -d 30 -u 30 wget http://armtest1.azure-devices.net
will do the work, but it is showing
failed: Connection refused
Also tried like this:
trickle -d 30 -u 30 wget --user=[myusername] --password=[mypassword] --auth-no-challenge http://armtest1.azure-devices.net
But still getting the same error.
It will be very helpful if you guys kindly point out my mistake and give me a way to achieve this using trickle.
Azure IoT Hub grants access to endpoints by verifying a token against the shared access policies and identity registry security credentials. Azure IoT Hub supports MQTT, AMQP, and HTTPS, these supported protocols transports tokens in different ways.HTTPS implements authentication by including a valid token in the Authorization request header. If you want to access(send data) to Azure IoT Hub using REST API, an existing device need to be specified.Please try to execute the following command:
trickle -s -d 30 -u 30 \
wget --header="Authorization:<generated SAS token for device>" \
--header="Content-Type:application/json" \
--post-data '<your data in json style>' \
"https://<your-iothub-host>.azure-devices.net/devices/<device id>/messages/events?api-version=2016-02-03"
In the command,something need to be clarified.
When you executed the command successfully,there will be a response like:
Connecting to <your-iothub-host>.azure-devices.net (<your-iothub-host>.azure-devices.net)|<ipaddress>|:443... connected.
HTTP request sent, awaiting response... 204 No Content
2018-01-03 22:33:53 (0.00 B/s) - ‘events?api-version=2016-02-03’ saved [0]
and, IoT Hub will receive the message, you can monitor the events through Device Explorer.