Properties have a type, and this affects how the user will edit the value, and how the value will be saved within the objects.
The type determines how objects can be sorted and queried. For instance, if you need to sort by a number, the property type must use a numeric type, if you select STRING, you will obtain unexpected result sorting objects.
Here below are described all the types you can use defining properties. The available types depend on the property you are defining (e.g. Thing property vs Customer property).
For each property type, it is also reported a sample JSON describing how the value is saved and accessible through the API.
Texts
These types are used to save text strings.
Type | Description |
---|---|
STRING | Allows the user to edit a single line text (e.g. a name, a short description). When creating a new property, this is the preselected one. |
JSON Encoding:
{
"stringProperty": "Foo Bar"
}
Flags
These types are used to save simple binary flags (e.g. Enable Foo Bar).
Type | Description |
---|---|
BOOLEAN | Allows the user to edit a boolean through a switch button. |
JSON Encoding:
{
"fooEnabled": true,
"barEnabled": false
}
Numbers
These types are used to save numbers (e.g. Tank Size).
Type | Description |
---|---|
INTEGER | Allows the user to edit an integer value. |
FLOAT | Allows the user to edit a floating point value. |
JSON Encoding:
{
"intProperty": 123,
"floatProperty": 1.2345
}
Values for these properties can also be validated by specifying the Minimum, Maximum and Step Increment values.
Dates and Times
These types are used to save dates and times.
Type | Description |
---|---|
DATE | Allows the user to edit a date value. |
JSON Encoding:
{
"dateProperty": 1687333193000
}
Contact Information
These types are used to manage contacts information (e.g. Email Address, Phone Number).
Type | Description |
---|---|
Allows the user to save an email address, also with validation. | |
MOBILE_PHONE | Allows the user to save Mobile phone number, used for SMS notifications. |
PHONE_NUMBER | Allows the user to save a generic phone number. |
CONTACTS | Allows the user to save a set of email addresses and mobile phone numbers to notify external contacts in case of problems. |
JSON Encoding
{
"emailProperty": "foo.bar@acme.com",
"mobilePhoneProperty": "+39 02 2561457",
"phoneNumberProperty": "+39 02 2561457",
"contactProperty": [
{
"name": "Mark Hamill",
"email": "mark.hamill@start-wars.com",
"mobilePhone": "+00 11 22334455",
"alertEmailEnabled": true,
"alertSmsEnabled": true,
"alertVoiceEnabled": false
}
]
}
Places
These types are used to manage place information (e.g. Address, City, State) on a location, customer or partner.
Type | Description |
---|---|
ADDRESS | Allows the user to save an address. |
STREET_NUMBER | Allows the user to save the street number. |
STATE | Allows the user to save a state/province. |
CITY | Allows the user to save a city. |
ZIP_CODE | Allows the user to save a zip code. |
JSON Encoding
{
"addressProperty": "via Cavour",
"streetNumberProperty": "12",
"stateProperty": "Milan",
"cityProperty": "Lomazzo",
"zipCodeProperty": "22074"
}
When using these properties, within the editing page, when you start typing in a field, the Google autocomplete popup appears helping you to select the right address, city and state.
You can decide whether the address must be saved in a single property by using the full form (e.g. via Cavour 12 Lomazzo, Milan, Italy). Otherwise, you can split the address in its parts and save them separately, to do this, it is enough to define all the property you need, by using the above place types. Now, when you select and address, it is automatically separated in its parts, and the relative other place fields are filled (e.g. State, Zip Code, City).
Files
These types are used to manage files (e.g. Images, Docs).
Type | Description |
---|---|
FILE | Allows the user to upload a file (e.g. Product Image). |
JSON Encoding:
{
"fileProperty": "{\"fileName\":\"boiler.png\",\"length\":985,\"path\":\"inventory/thingDefinitions/12345/fileProperties/6789\"}"
}
In order to get file details, the file property value must be parsed as a JSON.
To retrieve the file, you must perform an authenticated API request by suing the path in the parsed JSON.