Get Cached Data

Get Cached Messages from a Thing:

GET /get/dweets/for/{thing}

Retrieve the most recent messages sent by a device or application in the last 24 hours, up to 500 messages. The most recent message is returned first.

Contents

See also:
Get the Latest Data from a Thing
Get Streamed Data from a Thing

Uses and Requirements


Each message is stored on ThingSpace.io for 24 hours, up to a maximum of 500 messages. If a thing sends more than 500 messages in 24 hours, the oldest messages are deleted to make room for the newer ones.

Request Components


HTTP Request

GET https://thingspace.io/get/dweets/for/{thing}
NOTE: We recommend HTTPS for security, but both HTTP and HTTPS are supported.

Resource Path and Query Parameters

You must specify the unique name of the thing (device or application) that sent the messages in the resource path.

Parameter Name Data Type Description
thing
required
string The unique name of the device or application that sent the messages.
NOTE: There is no validity checking on thing names

Header Parameters

None.

Request Body

None.

Example Request

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

Success Responses


Status 200

The response body is a JSON-formatted message. All success responses begin with this preamble:

  "this": "succeeded",
  "by": "getting",
  "the": "dweets",

That is followed by the “with” object that contains an array of messages. Each message contains the thing name and a timestamp, followed by the contents of the message.

Example Success Response

{  
   "this":"succeeded",
   "by":"getting",
   "the":"dweets",
   "with":[  
      {  
         "thing":"my-thing-name",
         "created":"2016-10-07T17:59:24.720Z",
         "content":{  
            "status":"green",
            "temp":48
         }
      },
      {  
         "thing":"my-thing-name",
         "created":"2016-10-07T18:08:12.120Z",
         "content":{  
            "status":"yellow",
            "temp":51
         }
      },
      {  
         "thing":"my-thing-name",
         "created":"2016-10-07T18:19:01.220Z",
         "content":{  
            "status":"green",
            "temp":49
         }
      }
   ]
}

Failure Responses


Status 200
Errors are returned as HTTP status 200 in this format:

{
  "this": "failed",
  "with": HTTP status code,
  "because": "reason"
}

Where reason is a string describing the reason for the failure. The second line with the HTTP status code is not included in all error messages.

Try It Out!