The “Try It Now” forms at the bottom of this page let you build curl statements to try out the Device Messaging API requests and responses. For more information about any of the requests, see the API Reference.
Messaging Function | Description |
---|---|
Send Data | Send data from your thing to the cloud. |
Get Latest Data | Get the latest data from a thing. |
Get Cached Data | Get up to 500 cached messages sent by a thing in the last 24 hours. |
Get Streamed Data | Listen continuously for data from a thing. |
Send data from your device to ThingSpace.io, where it can be displayed in a freeboard dashboard or retrieved by your application.
To send JSON data in request body (required if there are nested data elements):
POST https://thingspace.io/dweet/for/{thing}
To send key-value pairs as query parameters:
GET https://thingspace.io/dweet/for/{thing}?{key}={value}
For GET requests, you can send any key-value pairs containing any data you wish to send.
$ curl https://thingspace.io/dweet/for/my-thing-name?hello=world
{
"this": "succeeded",
"by": "dweeting",
"the": "dweet",
"with": {
"thing": "my-thing-name",
"created": "2016-10-15T17:28:42.556Z",
"content": {
"hello": "world",
"foo": "bar"
}
}
}
Get the most recent data message sent by a device.
GET https://thingspace.io/get/latest/dweet/for/{thing}
$ curl https://thingspace.io/get/latest/dweet/for/my-thing-name
{
"this": "succeeded",
"by": "getting",
"the": "dweets",
"with": [
{
"thing": "my-thing-name",
"created": "2016-10-15T18:41:17.166Z",
"content": {
"this": "is cool!"
}
}
]
}
This request returns messages sent by a device over the last 24 hours, up to a maximum of 500 messages. The most recent message is returned first. ThingSpace.io keeps the 500 most recent messages from every device for 24 hours.
GET https://thingspace.io/get/dweets/for/{thing}
$ curl https://thingspace.io/get/dweets/for/my-thing-name
{
"this": "succeeded",
"by": "getting",
"the": "dweets",
"with": [
{
"thing": "my-thing-name",
"created": "2014-01-15T18:41:17.166Z",
"content": {
"this": "is cool!"
}
},
{
"thing": "my-thing-name",
"created": "2014-01-15T18:41:01.583Z",
"content": {
"hello": "world",
"foo": "bar"
}
}
]
}
Use this request in your app to listen continuously for messages from things.
GET https://thingspace.io/listen/for/dweets/from/{thing}
$ curl --raw https://thingspace.io/listen/for/dweets/from/my-thing-name
Try
It Out!