Create IoT Schema#
IoTSchema.Create
IoTSchema.CreateTemplate
IoTSchema.CreateFromTemplate
Overview#
This operation is used to create an IoT Schema. A template can also be created using a similar procedure and there is also the possibility of using a template to create the new object as well. This selection can be done in the main entity menu.
Setup#
No specific setup is required other than to meet the preconditions of the operation.
Preconditions#
- The IoT Schema does not currently exist in the system.
Sequence of Steps#
Step 1: General Data#
- Provide a name for the IoT Schema.
- Optionally, provide a description of the IoT Schema.
Step 2: Properties#
- On the left side panel, add as many properties as desired (select in the dropdown located in the top right of the grid to add, and to remove). The button allows adding top-level properties or, in case the property data type is IoT Schema, sub-properties of the main property.
-
For each property, specify:
- Name - This name must match the Event JSON document. It will be used internally to identify each property.
- Friendly Name - Alternative name to identify the property.
- Description - Property description.
- Array - Identifies this property as an array of objects.
- Mandatory - Identifies if the property is mandatory. If set to
true, this information will be used to validate all the arriving events. -
Indexed - Defines whether the property can be searched and queried. Furthermore, this determines whether the property is stored in the Kafka event header and in the Event Attribute table of the SQL Server Storage Consumer. For more information, see [[user-guide-sqlsinkeriotconsumerdefinition]].
Info
Array and Indexed properties are mutually exclusive.
-
Data Type - The data type of the property (mandatory, as an enumeration), which maps to the following JSON types (shown in parentheses):
- Boolean (integer)
- Date (date)
- DateTime (date-time)
- Decimal (number)
- EntityType (object) - Refers to an Entity Type object. In case of a versioned Entity Type, it refers to the Definition. The content of this property will be used by the enrichment process to map MES information to the original event's document.
- File (string) - Stores the File Id.
- Integer (integer)
- IoT Schema (object)
- Long (sting)
- String (string)
- Time (time)
- URL (uri)
- Default Value - Specifies the default value of the property. If not present in the received event, this value will be set by the event validation process.
- Minimum - The minimum value for data types of type integer. The event will be rejected if this value is less than what is defined.
- Maximum - The maximum value for data types of type integer. The event will be rejected if this value is exceeded.
- Min Length - Used to check the minimum length of a property of type string.
- Max Length - Used to check the maximum length of a property of type string.
- Pattern - For scalar types of type string, the pattern, for example:
^[A-Za-z]*@gmail.com$. This must be a valid Java regular expression. - Max File Size - For scalar types of type File, the maximum accepted file size.
- Max File Scale - Maximum file size scale if the Data Type is file (Kilobytes, Megabytes, Gigabytes).
- File Content Type - Used to select the File type the system will read. The system is able to read the following types: JSON, STEP, octet-stream, XML, CSV, excel among others.
- Shared - For IoT Schema data types. Setting an IoT Schema as shared, informs the system to create as IoT Schema object. This is useful to share JSON document definitions between Events (for example, Location definitions).
-
Select Create to complete the operation and the new IoT Schema will be created.
You can also add properties of an existing IoT Schema by selecting the Copy Schema Properties option in the dropdown.
Alternatively, you can also import a JSON or CSV definition of the desired schema by selecting the Import JSON option in the same dropdown.
Warning
If a schema is imported, a sanity check is strongly recommended as some property types can be incorrectly inferred (for example, integer instead of decimal).



