Property Types

Prev Next

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 to define properties. The available types depend on the property you are defining (e.g., Thing property vs Customer property).
For each property type, a sample JSON is also reported 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 of 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 contact information (e.g., Email Address, Phone Number).

Type

Description

EMAIL

Allows the user to save an email address, also with validation.

MOBILE_PHONE

Allows the user to save a 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 additional contacts, including: name, email address, mobile phone number, and notification preferences.

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, in the DPS within the editing page of an entity (customer, location, or partner), when the user you start typing in a field, the Google autocomplete pop-up 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 into its parts and save them separately.
To do this, it is enough to define all the properties you need by using the above place types. Now, when you select an address, it is automatically separated into its parts, and the other place fields are filled (e.g., State, Zip Code, City).
In the case of Location editing, the GPS coordinates are also populated.

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\"}"
}

To get file details, the file property value must be parsed as JSON.
To retrieve the file, you must perform an authenticated API request by using the path in the parsed JSON.

GET https://<HOST_NAME>/api/inventory/thingDefinitions/12345/fileProperties/6789