Thing Schema
Our Thing schema provides a standard schema definition for the Things in your world, compliant with the Web of Things Thing Description and built on top of the popular "JSON Schema" definition.
It gives your application standard interfaces to communicate with Things in Collections in the AnythingDB and provides a means for Things in your application to reference and communicate with entities outside of your application.
{
"actions": {
"toggleOn": {
"input": {
"type": "boolean"
}
},
"volumeChange": {
"description": "Change the volume of the Sound Stereo System",
"input": {
"properties": {
"Volumelevelduration": {
"minimum": 0,
"type": "integer",
"unit": "seconds"
},
"level": {
"maximum": 100,
"minimum": 0,
"type": "integer"
}
},
"type": "object"
},
"title": "Change the Volume"
}
},
"base": "https://api.swx.altairone.com",
"collection": "my-collection",
"created": "2021-10-11T14:05:56+00:00",
"description": "",
"events": {
"overheating": {
"data": {
"description": "The roof. The roof.",
"title": "Stereo Overheating",
"type": "string"
}
}
},
"href": "/spaces/my-space/collections/my-collection/things/01FHQTS842GDVVVSSGER1HSTE1",
"id": "https://api.swx.altairone.com/spaces/my-space/collections/my-collection/things/01FHQTS842GDVVVSSGER1HSTE1",
"model": {
"name": "",
"version": 0
},
"modified": "2021-10-11T14:09:05+00:00",
"properties": {
"status": {
"type": "string"
},
"volume": {
"description": "The volume of the Sound Stereo System",
"maximum": 100,
"minimum": 0,
"title": "Volume",
"type": "integer"
}
},
"space": "my-space",
"title": "Office 211b Stereo",
"uid": "01FHQTS842GDVVVSSGER1HSTE1"
}
- Several identifiers like
id
andtitle
to differentiate this Thing description from others status
andvolume
properties for describing the current state of the ThingtoggleOn
andvolumeChange
actions for adjusting the current state- An
overheating
event to tell users that something worth noting is happening
All this helps create user experiences in applications that fit the data. You can use the "unit" definitions to populate a label in an input field, you can use the "type" definitions to determine whether a toggle switch is needed or an input field, and you can use the "maximum" and "minimum" definitions to validate that the data received is within expected bounds.
{
"actions": {},
"base": "https://api.swx.altairone.com",
"collection": "my-collection",
"created": "2021-08-23T11:10:45+00:00",
"description": "",
"events": {},
"href": "/spaces/myspace/collections/my-collection/things/01FDSB98PRZG0PW9YH2SSJA869",
"id": "https://api.swx.altairone.com/spaces/myspace/collections/my-collection/things/01FDSB98PRZG0PW9YH2SSJA869",
"model": {
"name": "my-model",
"version": 4
},
"modified": "2021-08-23T11:10:45+00:00",
"properties": {},
"space": "myspace",
"title": "Office 211b Stereo",
"uid": "01FDSB98PRZG0PW9YH2SSJA869"
}
Metadata Key | Description | Auto-generated? | Required? | Type |
---|---|---|---|---|
title |
Title of the entity to display in the UI | No | Yes | string |
id |
Unique reference ID for the Thing. | Yes | Yes | string |
description |
Additional content to help tell the user what the entity is. | No | No | string |
properties |
An object which defines the unique attributes that make up this entity. | No | No | object |
actions |
An object which defines the way a user can interact with the entity. | No | No | object |
events |
The types of events which the entity may generate on it's own. | No | No | object |
links |
The interfaces for establishing relation between entities. | Yes | Yes | array |
Metadata Key | Description | Auto-generated? | Required? | Type |
---|---|---|---|---|
uid |
Unique identifier for this Thing | Yes | Yes | string |
href |
Relative reference point for this Thing | Yes | Yes | string |
collection |
AnythingDB Collection to which this Thing belongs. | Yes | Yes | string |
space |
SmartWorks space to which this Thing belongs | Yes | Yes | string |
model |
Model from which this Thing was created. | Yes | Yes | object |
{
"actions": {},
"base": "https://api.swx.altairone.com",
"collection": "Links",
"created": "2021-10-25T17:03:04+00:00",
"description": "",
"events": {},
"href": "/spaces/my-space/collections/my-collection/things/01FJW6FMVY668YWP27JFNKFZT7",
"id": "https://api.swx.altairone.com/spaces/ my-space /collections/ my-collection /things/01FJW6FMVY668YWP27JFNKFZT7",
"model": {
"name": "my-model",
"version": 1
},
"modified": "2021-10-25T17:03:04+00:00",
"properties": {},
"space": "demoworkspace",
"title": "thing",
"uid": "01FJW6FMVY668YWP27JFNKFZT7"
}
Any element that does not fall into one of the above building blocks will be ignored and removed when building your schema in SmartWorks IoT.
The above building blocks can be used to describe enormously complex assets. However, you can always create an empty Thing without filling in the fields described above (i.e empty properties, actions and events), giving you flexibility to add them to the device whenever it is desired.