Use a POST request to send data from a device or application to ThingSpace.io, with the data in the body of the request.
See also:
Send data from a thing or app using GET
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.
POST https://thingspace.io/dweet/for/{thing}
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. |
None.
The request body contains the data to be sent, in JSON format. The request body cannot be more than 2,000 characters.
{
"status": "green",
"BatVoltage": 2034,
"BatCurrent": 100,
"Inputs": {
"InputVoltage1": 121,
"InputVoltage2": 123
},
"Outputs": {
"OutputVoltage1": 120,
"OutputVoltage2": 120
}
}
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.
{
"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
}
}
}
}
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!