How to send streams with hURL
This tutorial will show how to send data streams to Carriots with hURL.
First, we need to know what we want to send and how to send it. Data is sent to Carriots REST API. You need:
- A device in Carriots
- A valid Apikey
- Your data
- A REST client
If youre registered in Carriots, you have a default device already created for you.
Check your control panel and see what it looks like.
Basically you need the device id_developer that might be something like defaultDevice@myusername.
We will assume we have the test@carriots device for this tutorial.
Now, go to your control panel “My account menu” and check your Apikey.
Its a big alphanumeric token like 98346673a6377ef1fde2357ebdcb0da582b150b00cabcd5a0d83045425407ab4.
Now we define our data. It will be a simple data set with temperature and humidity:
Finally we need a REST client. This client can be whatever you want that can create full HTTP request including headers, verbs and so on.
Follow these steps:
- Open the web page-> http://www.hurl.it/
- In the "Destination" section select "POST" and type -> http://api.carriots.com/streams/
- In the "Headers" section, type "carriots.apikey" and your apikey
- If you want to send stream in XML format, add in the "Headers" section: "content-type" -> application/xml
In the "Parameters" section select "Add Body" and type your payload.
- Click "Launch Request"
You should have something like this:
Now you can see your stream listed in the control panel stream list. Go to “Data management” → “Data streams” and you will see your data.
Its easy, isnt it?. Enjoy Carriots!