Send Data With POST

Send data from a thing or app using POST:

POST /dweet/for/{thing}

Use a POST request to send data from a device or application to ThingSpace.io, with the data in the body of the request.

  • The data will be stored for 24 hours (maximum of 500 messages per thing)
  • Your application can listen continuously for data from things, or it can retrieve the latest data.
  • Devices can listen continuously for messages from your application, or they can retrieve the latest messages.
  • Data can be displayed in a freeboard.

Contents

See also:
Send data from a thing or app using GET

Uses and Requirements


Each dweet from a device or application must contain all data that the device is capable of sending. For example, if a car is monitoring speed, engine RPM, and oil pressure, each dweet must contain all three measurements, instead of three separate dweets that each contain only one measurement.

Dweets cannot be more than 2,000 characters.

Request Components


HTTP Request

POST https://thingspace.io/dweet/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 device or application that is sending the dweet in the resource path.

Parameter Name Data Type Description
thing
required
string The unique name of the device or application. Other devices, applications, and freeboards can use this name to get data sent by the device.
NOTE: There is no validity checking on thing names

Header Parameters

None.

Request Body

The request body contains the data to be sent, in JSON format. The request body cannot be more than 2,000 characters.

Example Request Body

{
   "status": "green",
   "BatVoltage": 2034,
   "BatCurrent": 100,
   "Inputs": {
      "InputVoltage1": 121,
      "InputVoltage2": 123
   },
   "Outputs": {
      "OutputVoltage1": 120,
      "OutputVoltage2": 120
   }
}

Success Responses


Response Format

Status 200

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

  "this": "succeeded",
  "by": "dweeting",
  "the": "dweet",

That is followed by the “with” object that contains the thing name and a timestamp for the dweet, followed by the contents that were recorded.

Example Success Response

{
  "this": "succeeded",
  "by": "dweeting",
  "the": "dweet",
  "with": {
    "thing": "my-thing-name",
    "created": "2016-10-07T17:59:24.720Z",
    "content": {
      "status": "green",
      "BatVoltage": 2034,
      "BatCurrent": 100,
      "Inputs": {
        "InputVoltage1": 121,
        "InputVoltage2": 123
      },
      "Outputs": {
        "OutputVoltage1": 120,
        "OutputVoltage2": 120
      }
    }
  }
}

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!