API Console

Try the Device Messaging API

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 a thing


Send data from your device to ThingSpace.io, where it can be displayed in a freeboard dashboard or retrieved by your application.

Request

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}

Query parameters

For GET requests, you can send any key-value pairs containing any data you wish to send.

ThingSpace.io will also respond to JSONP requests with a ?callback= query parameter.

Example

$ curl https://thingspace.io/dweet/for/my-thing-name?hello=world

Response

{
  "this": "succeeded",
  "by": "dweeting",
  "the": "dweet",
  "with": {
    "thing": "my-thing-name",
    "created": "2016-10-15T17:28:42.556Z",
    "content": {
      "hello": "world",
      "foo": "bar"
    }
  }
}

Get latest data


Get the most recent data message sent by a device.

Request

GET https://thingspace.io/get/latest/dweet/for/{thing}

Example

$ curl https://thingspace.io/get/latest/dweet/for/my-thing-name

Response

{
  "this": "succeeded",
  "by": "getting",
  "the": "dweets",
  "with": [
    {
      "thing": "my-thing-name",
      "created": "2016-10-15T18:41:17.166Z",
      "content": {
        "this": "is cool!"
      }
    }
  ]
}
Note: ThingSpace.io only keeps the most recent 500 messages over a 24 hour period. If the thing hasn't sent a message in the last 24 hours, there will be no data to get.

Get cached messages from a thing


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.

Request

GET https://thingspace.io/get/dweets/for/{thing}

Example

$ curl https://thingspace.io/get/dweets/for/my-thing-name

Response

{
  "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"
      }
    }
  ]
}
Note: ThingSpace.io only keeps the last 500 messages over a 24 hour period. If the thing hasn't sent a message in the last 24 hours, there will be no data to get.

Get streamed data from a thing


Use this request in your app to listen continuously for messages from things.

Request

GET https://thingspace.io/listen/for/dweets/from/{thing}
Note: This function uses HTTP chunked responses and cannot be tested in a browser.

Example

$ curl --raw https://thingspace.io/listen/for/dweets/from/my-thing-name
Try It Out!