The "createThing" action creates a new object to represent a sensor, device, equipment, server, software application, etc.
Request examples
Minimal
{
"action": "createThing",
"params": {
"thingName": "My Device"
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}Maximal
{
"api": "hub",
"action": "createThing",
"params": {
"thingName": "My Device #2",
"status": "active",
"manufacturer": "Manufacturer",
"model": "ACME-123",
"serialNumber": "AB678",
"thingType": "ACME Temperature Sensor",
"purpose": "Stamper temperature",
"location": "factory1/line1/station1",
"lifecycleLabels": ["acquired", "testing"],
"hostnames": [ "127.0.0.1" ],
"description": "The ACME Temperature Sensor gathers temperature data from the ACME stamper.",
"metadata": { "myProperty": "myValue" },
"photo": "/9j/7gAhQWRvYmUAZEAAAAABAwAQAwIDBgAAAAAAAAAAAAAAAP",
"binaryFormat": "base64"
},
"responseOptions": {
"binaryFormat": "hex"
},
"authToken": "replaceWithAuthTokenFromCreateSession",
"requestId": "1",
"debug": "none"
}
Response examples
Minimal
{
"authToken": "replaceWithAuthTokenFromCreateSession",
"result": {
"id": 1,
"thingName": "My Device",
//...use the values for "My Device" as shown in the response to describeThings...
},
"errorCode": 0,
"errorMessage": ""
}Maximal
{
"result": {
"id": 2,
"thingName": "My Device #2",
//...use the values for "Changed Name" as shown in the response to describeThings...
},
"authToken": "replaceWithAuthTokenFromCreateSession",
"requestId": "1",
"errorCode": 0,
"errorMessage": ""
}
Properties
Request properties ("params")
| Property | Description | Default | Type | Limits (inclusive) |
|---|---|---|---|---|
binaryFormat |
The "binaryFormat" property designates the format of binary values embedded in JSON strings. For more details, see "binaryFormat". |
Optional with default of "hex"
|
string | One of the following: "base64", "hex", or "byteArray". |
description |
The "description" property describes objects such as code packages, labels, or things. The server indexes this field with a full-text index so that you can search for any word or phrase. You cannot use this property for filtering in the Thing API. |
Optional with default of "unknown" |
string | 1 to 512 bytes |
hostnames |
The
When you use the
The Thing API implements the
|
Optional with default of []
|
string | Array of user-defined hostnames. Each hostname is a string from 0 to 64 bytes. Values are managed in the Label API with the group of "faircom/hostnames". |
lifecycleLabels |
The "lifecycleLabels" property assigns zero or more lifecycle labels to a thing. You can use it for fast lookups and filtering. |
Optional with default of []
|
array of strings |
"archived""acquired""deprecated""decommissioned""disposed""end-of-life""out-of-warranty""operational""testing""unknown"
|
location |
The
This API uses the Label API to manage manufacturers.
|
Optional with default of "unknown"
|
string |
1 to 64 bytes Values are managed in the Label API with the group of |
manufacturer |
The
This API uses the Label API to manage manufacturers.
|
Optional with default of "unknown"
|
string | 1 to 64 bytes |
metadata |
The "metadata" property contains user-defined properties that add keywords and tags about the code package. The server indexes this field with a full-text index so you can search for any word or phrase to find code packages. |
Optional with default of {}
|
object | 0 or more key/value pairs |
model |
The
This API uses the Label API to manage models.
|
Optional with default of "unknown"
|
string | 1 to 64 bytes |
photo |
The "photo" property contains a photo of a thing. You cannot use it for lookups and filtering. |
Optional with default of null
|
string containing a binary value | Up to 2 GB |
purpose |
The
In the Thing API, the
The Thing API uses the Label API to manage purposes.
|
Optional with default of
|
string | 1 to 64 bytes |
serialNumber |
The "serialNumber" property specifies a thing's serial number. Typically a serial number uniquely identifies a thing, but things from different manufacturers may have the same serial numbers. You can use it to do partial lookups and filtering. |
Optional with default of "unknown"
|
string | 1 to 64 bytes |
status |
The
When the
To create, alter, and list inactive items, set the |
Optional with default of "active"
|
string enum |
|
thingName |
The "thingName" property specifies the unique name of a thing. It cannot be the empty string "". |
Required - No default value | string | 1 to 64 bytes |
thingType |
The
This API uses the Label API to manage types.
|
Optional with default of "unknown"
|
string | 1 to 64 bytes |
Response properties ("result")
| Property | Description | Type | Limits (inclusive) |
|---|---|---|---|
id |
The |
integer |
|
thingName |
The "thingName" property specifies the unique name of a thing. It cannot be the empty string "". |
string | 1 to 64 bytes |