openapi: 3.1.0 info: title: ThingsBoard Admin admin-controller entity-query-controller API description: 'ThingsBoard Admin API — subset of the ThingsBoard REST API (open-source IoT platform). Covers: Admin, Audit Log, Event, Usage Info, Queue, Queue Stats, Mail Config Template, Qr Code Settings, Job.' version: 4.3.0.3DEMO contact: name: ThingsBoard team url: https://thingsboard.io email: info@thingsboard.io license: name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0 servers: - url: https://demo.thingsboard.io description: ThingsBoard Live Demo - url: http://localhost:8080 description: Local ThingsBoard server tags: - name: entity-query-controller description: Entity Query paths: /api/entitiesQuery/find: post: tags: - entity-query-controller summary: Find Entity Data by Query description: "Allows to run complex queries over platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the paginated result of the query that contains requested entity fields and latest values of requested attributes and time series data.\n\n# Query Definition\n\n\n\nMain **entity filter** is mandatory and defines generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\"\n\nOptional **key filters** allow to filter results of the **entity filter** by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts with 'T', and attribute 'model' is 'T1000', and time series field 'batteryLevel' > 40\".\n\nThe **entity fields** and **latest values** contains list of entity fields and latest attribute/telemetry fields to fetch for each entity.\n\nThe **page link** contains information about the page to fetch and the sort ordering.\n\nLet's review the example:\n\n```json\n{\n \"entityFilter\": {\n \"type\": \"entityType\",\n \"resolveMultiple\": true,\n \"entityType\": \"DEVICE\"\n },\n \"keyFilters\": [\n {\n \"key\": {\n \"type\": \"TIME_SERIES\",\n \"key\": \"temperature\"\n },\n \"valueType\": \"NUMERIC\",\n \"predicate\": {\n \"operation\": \"GREATER\",\n \"value\": {\n \"defaultValue\": 0,\n \"dynamicValue\": {\n \"sourceType\": \"CURRENT_USER\",\n \"sourceAttribute\": \"temperatureThreshold\",\n \"inherit\": false\n }\n },\n \"type\": \"NUMERIC\"\n }\n }\n ],\n \"entityFields\": [\n {\n \"type\": \"ENTITY_FIELD\",\n \"key\": \"name\"\n },\n {\n \"type\": \"ENTITY_FIELD\",\n \"key\": \"label\"\n },\n {\n \"type\": \"ENTITY_FIELD\",\n \"key\": \"additionalInfo\"\n }\n ],\n \"latestValues\": [\n {\n \"type\": \"ATTRIBUTE\",\n \"key\": \"model\"\n },\n {\n \"type\": \"TIME_SERIES\",\n \"key\": \"temperature\"\n }\n ],\n \"pageLink\": {\n \"page\": 0,\n \"pageSize\": 10,\n \"sortOrder\": {\n \"key\": {\n \"key\": \"name\",\n \"type\": \"ENTITY_FIELD\"\n },\n \"direction\": \"ASC\"\n }\n }\n}\n```\n\n Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax:\n\n # Entity Filters\nEntity Filter body depends on the 'type' parameter. Let's review available entity filter types. In fact, they do correspond to available dashboard aliases.\n\n## Single Entity\n\nAllows to filter only one entity based on the id. For example, this entity filter selects certain device:\n\n```json\n{\n \"type\": \"singleEntity\",\n \"singleEntity\": {\n \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\",\n \"entityType\": \"DEVICE\"\n }\n}\n```\n\n## Entity List Filter\n\nAllows to filter entities of the same type using their ids. For example, this entity filter selects two devices:\n\n```json\n{\n \"type\": \"entityList\",\n \"entityType\": \"DEVICE\",\n \"entityList\": [\n \"e6501f30-2a7a-11ec-94eb-213c95f54092\",\n \"e6657bf0-2a7a-11ec-94eb-213c95f54092\"\n ]\n}\n```\n\n## Entity Name Filter\n\nAllows to filter entities of the same type using the **'starts with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality':\n\n```json\n{\n \"type\": \"entityName\",\n \"entityType\": \"DEVICE\",\n \"entityNameFilter\": \"Air Quality\"\n}\n```\n\n## Entity Type Filter\n\nAllows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this entity filter selects all tenant customers:\n\n```json\n{\n \"type\": \"entityType\",\n \"entityType\": \"CUSTOMER\"\n}\n```\n\n## Asset Type Filter\n\nAllows to filter assets based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla':\n\n```json\n{\n \"type\": \"assetType\",\n \"assetType\": \"charging station\",\n \"assetNameFilter\": \"Tesla\"\n}\n```\n\n## Device Type Filter\n\nAllows to filter devices based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC':\n\n```json\n{\n \"type\": \"deviceType\",\n \"deviceType\": \"Temperature Sensor\",\n \"deviceNameFilter\": \"ABC\"\n}\n```\n\n## Edge Type Filter\n\nAllows to filter edge instances based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Factory' edge instances which name starts with 'Nevada':\n\n```json\n{\n \"type\": \"edgeType\",\n \"edgeType\": \"Factory\",\n \"edgeNameFilter\": \"Nevada\"\n}\n```\n\n## Entity View Filter\n\nAllows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT':\n\n```json\n{\n \"type\": \"entityViewType\",\n \"entityViewType\": \"Concrete Mixer\",\n \"entityViewNameFilter\": \"CAT\"\n}\n```\n\n## Api Usage Filter\n\nAllows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage' entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092':\n\n```json\n{\n \"type\": \"apiUsageState\",\n \"customerId\": {\n \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\",\n \"entityType\": \"CUSTOMER\"\n }\n}\n```\n\n## Relations Query Filter\n\nAllows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'.\n\nFor example, this entity filter selects all devices and assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092':\n\n```json\n{\n \"type\": \"relationsQuery\",\n \"rootEntity\": {\n \"entityType\": \"ASSET\",\n \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\"\n },\n \"direction\": \"FROM\",\n \"maxLevel\": 1,\n \"fetchLastLevelOnly\": false,\n \"filters\": [\n {\n \"relationType\": \"Contains\",\n \"entityTypes\": [\n \"DEVICE\",\n \"ASSET\"\n ]\n }\n ]\n}\n```\n\n## Asset Search Query\n\nAllows to filter assets that are related to the provided root entity. Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions.\n\nFor example, this entity filter selects 'charging station' assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation:\n\n```json\n{\n \"type\": \"assetSearchQuery\",\n \"rootEntity\": {\n \"entityType\": \"ASSET\",\n \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\"\n },\n \"direction\": \"FROM\",\n \"maxLevel\": 1,\n \"fetchLastLevelOnly\": false,\n \"relationType\": \"Contains\",\n \"assetTypes\": [\n \"charging station\"\n ]\n}\n```\n\n## Device Search Query\n\nAllows to filter devices that are related to the provided root entity. Filters related devices based on the relation type and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions.\n\nFor example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation:\n\n```json\n{\n \"type\": \"deviceSearchQuery\",\n \"rootEntity\": {\n \"entityType\": \"ASSET\",\n \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\"\n },\n \"direction\": \"FROM\",\n \"maxLevel\": 2,\n \"fetchLastLevelOnly\": true,\n \"relationType\": \"Contains\",\n \"deviceTypes\": [\n \"Air Quality Sensor\",\n \"Charging port\"\n ]\n}\n```\n\n## Entity View Query\n\nAllows to filter entity views that are related to the provided root entity. Filters related entity views based on the relation type and set of entity view types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'entityViewTypes' defines the type of the entity view to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions.\n\nFor example, this entity filter selects 'Concrete mixer' entity views which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation:\n\n```json\n{\n \"type\": \"entityViewSearchQuery\",\n \"rootEntity\": {\n \"entityType\": \"ASSET\",\n \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\"\n },\n \"direction\": \"FROM\",\n \"maxLevel\": 1,\n \"fetchLastLevelOnly\": false,\n \"relationType\": \"Contains\",\n \"entityViewTypes\": [\n \"Concrete mixer\"\n ]\n}\n```\n\n## Edge Search Query\n\nAllows to filter edge instances that are related to the provided root entity. Filters related edge instances based on the relation type and set of edge types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions.\n\nFor example, this entity filter selects 'Factory' edge instances which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation:\n\n```json\n{\n \"type\": \"deviceSearchQuery\",\n \"rootEntity\": {\n \"entityType\": \"ASSET\",\n \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\"\n },\n \"direction\": \"FROM\",\n \"maxLevel\": 2,\n \"fetchLastLevelOnly\": true,\n \"relationType\": \"Contains\",\n \"edgeTypes\": [\n \"Factory\"\n ]\n}\n```\n\n # Key Filters\nKey Filter allows you to define complex logical expressions over entity field, attribute or latest time series value. The filter is defined using 'key', 'valueType' and 'predicate' objects. Single Entity Query may have zero, one or multiple predicates. If multiple filters are defined, they are evaluated using logical 'AND'. The example below checks that temperature of the entity is above 20 degrees:\n\n```json\n{\n \"key\": {\n \"type\": \"TIME_SERIES\",\n \"key\": \"temperature\"\n },\n \"valueType\": \"NUMERIC\",\n \"predicate\": {\n \"operation\": \"GREATER\",\n \"value\": {\n \"defaultValue\": 20,\n \"dynamicValue\": null\n },\n \"type\": \"NUMERIC\"\n }\n}\n```\n\n Now let's review 'key', 'valueType' and 'predicate' objects in detail.\n\n## Filter Key\n\nFilter Key defines either entity field, attribute or telemetry. It is a JSON object that consists the key name and type. The following filter key types are supported: \n\n * 'CLIENT_ATTRIBUTE' - used for client attributes; \n * 'SHARED_ATTRIBUTE' - used for shared attributes; \n * 'SERVER_ATTRIBUTE' - used for server attributes; \n * 'ATTRIBUTE' - used for any of the above; \n * 'TIME_SERIES' - used for time series values; \n * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; \n * 'ALARM_FIELD' - similar to entity field, but is used in alarm queries only; \n\n\n Let's review the example:\n\n```json\n{\n \"type\": \"TIME_SERIES\",\n \"key\": \"temperature\"\n}\n```\n\n## Value Type and Operations\n\nProvides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: \n\n * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; \n * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; \n * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL;\n * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; \n\n\n## Filter Predicate\n\nFilter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key.\n\nSimple predicate example to check 'value < 100': \n\n```json\n{\n \"operation\": \"LESS\",\n \"value\": {\n \"defaultValue\": 100,\n \"dynamicValue\": null\n },\n \"type\": \"NUMERIC\"\n}\n```\n\nComplex predicate example, to check 'value < 10 or value > 20': \n\n```json\n{\n \"type\": \"COMPLEX\",\n \"operation\": \"OR\",\n \"predicates\": [\n {\n \"operation\": \"LESS\",\n \"value\": {\n \"defaultValue\": 10,\n \"dynamicValue\": null\n },\n \"type\": \"NUMERIC\"\n },\n {\n \"operation\": \"GREATER\",\n \"value\": {\n \"defaultValue\": 20,\n \"dynamicValue\": null\n },\n \"type\": \"NUMERIC\"\n }\n ]\n}\n```\n\nMore complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': \n\n```json\n{\n \"type\": \"COMPLEX\",\n \"operation\": \"OR\",\n \"predicates\": [\n {\n \"operation\": \"LESS\",\n \"value\": {\n \"defaultValue\": 10,\n \"dynamicValue\": null\n },\n \"type\": \"NUMERIC\"\n },\n {\n \"type\": \"COMPLEX\",\n \"operation\": \"AND\",\n \"predicates\": [\n {\n \"operation\": \"GREATER\",\n \"value\": {\n \"defaultValue\": 50,\n \"dynamicValue\": null\n },\n \"type\": \"NUMERIC\"\n },\n {\n \"operation\": \"LESS\",\n \"value\": {\n \"defaultValue\": 60,\n \"dynamicValue\": null\n },\n \"type\": \"NUMERIC\"\n }\n ]\n }\n ]\n}\n```\n\n You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > 'value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or user that is performing the API call. See example below: \n\n```json\n{\n \"operation\": \"GREATER\",\n \"value\": {\n \"defaultValue\": 0,\n \"dynamicValue\": {\n \"sourceType\": \"CURRENT_USER\",\n \"sourceAttribute\": \"temperatureThreshold\"\n }\n },\n \"type\": \"NUMERIC\"\n}\n```\n\n Note that you may use 'CURRENT_USER', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source.\n\nAvailable for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority." operationId: findEntityDataByQuery requestBody: content: application/json: schema: $ref: '#/components/schemas/EntityDataQuery' required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/PageDataEntityData' /api/entitiesQuery/find/keys: post: tags: - entity-query-controller summary: Find Available Entity Keys by Query description: 'Returns unique time series and/or attribute key names from entities matching the query. Executes the Entity Data Query to find up to 100 entities, then fetches and aggregates all distinct key names. Primarily used for UI features like autocomplete suggestions. Available for users with ''TENANT_ADMIN'' or ''CUSTOMER_USER'' authority.' operationId: findAvailableEntityKeysByQuery parameters: - name: timeseries in: query description: 'When true, includes unique time series key names in the response. When false, the ''timeseries'' list will be empty.' required: true schema: type: boolean - name: attributes in: query description: 'When true, includes unique attribute key names in the response. When false, the ''attribute'' list will be empty. Use ''scope'' parameter to filter by attribute scope.' required: true schema: type: boolean - name: scope in: query description: 'Filters attribute keys by scope. Only applies when ''attributes'' is true. If not specified, returns attribute keys from all scopes.' required: false schema: type: string enum: - SERVER_SCOPE - SHARED_SCOPE - CLIENT_SCOPE requestBody: content: application/json: schema: $ref: '#/components/schemas/EntityDataQuery' required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AvailableEntityKeys' /api/entitiesQuery/count: post: tags: - entity-query-controller summary: Count Entities by Query description: "Allows to run complex queries to search the count of platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the number of entities that match the query definition.\n\n# Query Definition\n\n\n\nMain **entity filter** is mandatory and defines generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\"\n\nOptional **key filters** allow to filter results of the entity filter by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts with 'T', and attribute 'model' is 'T1000', and time series field 'batteryLevel' > 40\".\n\nLet's review the example:\n\n```json\n{\n \"entityFilter\": {\n \"type\": \"entityType\",\n \"entityType\": \"DEVICE\"\n },\n \"keyFilters\": [\n {\n \"key\": {\n \"type\": \"ATTRIBUTE\",\n \"key\": \"active\"\n },\n \"valueType\": \"BOOLEAN\",\n \"predicate\": {\n \"operation\": \"EQUAL\",\n \"value\": {\n \"defaultValue\": true,\n \"dynamicValue\": null\n },\n \"type\": \"BOOLEAN\"\n }\n }\n ]\n}\n```\n\n Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax:\n\n # Entity Filters\nEntity Filter body depends on the 'type' parameter. Let's review available entity filter types. In fact, they do correspond to available dashboard aliases.\n\n## Single Entity\n\nAllows to filter only one entity based on the id. For example, this entity filter selects certain device:\n\n```json\n{\n \"type\": \"singleEntity\",\n \"singleEntity\": {\n \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\",\n \"entityType\": \"DEVICE\"\n }\n}\n```\n\n## Entity List Filter\n\nAllows to filter entities of the same type using their ids. For example, this entity filter selects two devices:\n\n```json\n{\n \"type\": \"entityList\",\n \"entityType\": \"DEVICE\",\n \"entityList\": [\n \"e6501f30-2a7a-11ec-94eb-213c95f54092\",\n \"e6657bf0-2a7a-11ec-94eb-213c95f54092\"\n ]\n}\n```\n\n## Entity Name Filter\n\nAllows to filter entities of the same type using the **'starts with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality':\n\n```json\n{\n \"type\": \"entityName\",\n \"entityType\": \"DEVICE\",\n \"entityNameFilter\": \"Air Quality\"\n}\n```\n\n## Entity Type Filter\n\nAllows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this entity filter selects all tenant customers:\n\n```json\n{\n \"type\": \"entityType\",\n \"entityType\": \"CUSTOMER\"\n}\n```\n\n## Asset Type Filter\n\nAllows to filter assets based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla':\n\n```json\n{\n \"type\": \"assetType\",\n \"assetType\": \"charging station\",\n \"assetNameFilter\": \"Tesla\"\n}\n```\n\n## Device Type Filter\n\nAllows to filter devices based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC':\n\n```json\n{\n \"type\": \"deviceType\",\n \"deviceType\": \"Temperature Sensor\",\n \"deviceNameFilter\": \"ABC\"\n}\n```\n\n## Edge Type Filter\n\nAllows to filter edge instances based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Factory' edge instances which name starts with 'Nevada':\n\n```json\n{\n \"type\": \"edgeType\",\n \"edgeType\": \"Factory\",\n \"edgeNameFilter\": \"Nevada\"\n}\n```\n\n## Entity View Filter\n\nAllows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT':\n\n```json\n{\n \"type\": \"entityViewType\",\n \"entityViewType\": \"Concrete Mixer\",\n \"entityViewNameFilter\": \"CAT\"\n}\n```\n\n## Api Usage Filter\n\nAllows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage' entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092':\n\n```json\n{\n \"type\": \"apiUsageState\",\n \"customerId\": {\n \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\",\n \"entityType\": \"CUSTOMER\"\n }\n}\n```\n\n## Relations Query Filter\n\nAllows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'.\n\nFor example, this entity filter selects all devices and assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092':\n\n```json\n{\n \"type\": \"relationsQuery\",\n \"rootEntity\": {\n \"entityType\": \"ASSET\",\n \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\"\n },\n \"direction\": \"FROM\",\n \"maxLevel\": 1,\n \"fetchLastLevelOnly\": false,\n \"filters\": [\n {\n \"relationType\": \"Contains\",\n \"entityTypes\": [\n \"DEVICE\",\n \"ASSET\"\n ]\n }\n ]\n}\n```\n\n## Asset Search Query\n\nAllows to filter assets that are related to the provided root entity. Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions.\n\nFor example, this entity filter selects 'charging station' assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation:\n\n```json\n{\n \"type\": \"assetSearchQuery\",\n \"rootEntity\": {\n \"entityType\": \"ASSET\",\n \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\"\n },\n \"direction\": \"FROM\",\n \"maxLevel\": 1,\n \"fetchLastLevelOnly\": false,\n \"relationType\": \"Contains\",\n \"assetTypes\": [\n \"charging station\"\n ]\n}\n```\n\n## Device Search Query\n\nAllows to filter devices that are related to the provided root entity. Filters related devices based on the relation type and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions.\n\nFor example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation:\n\n```json\n{\n \"type\": \"deviceSearchQuery\",\n \"rootEntity\": {\n \"entityType\": \"ASSET\",\n \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\"\n },\n \"direction\": \"FROM\",\n \"maxLevel\": 2,\n \"fetchLastLevelOnly\": true,\n \"relationType\": \"Contains\",\n \"deviceTypes\": [\n \"Air Quality Sensor\",\n \"Charging port\"\n ]\n}\n```\n\n## Entity View Query\n\nAllows to filter entity views that are related to the provided root entity. Filters related entity views based on the relation type and set of entity view types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'entityViewTypes' defines the type of the entity view to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions.\n\nFor example, this entity filter selects 'Concrete mixer' entity views which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation:\n\n```json\n{\n \"type\": \"entityViewSearchQuery\",\n \"rootEntity\": {\n \"entityType\": \"ASSET\",\n \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\"\n },\n \"direction\": \"FROM\",\n \"maxLevel\": 1,\n \"fetchLastLevelOnly\": false,\n \"relationType\": \"Contains\",\n \"entityViewTypes\": [\n \"Concrete mixer\"\n ]\n}\n```\n\n## Edge Search Query\n\nAllows to filter edge instances that are related to the provided root entity. Filters related edge instances based on the relation type and set of edge types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions.\n\nFor example, this entity filter selects 'Factory' edge instances which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation:\n\n```json\n{\n \"type\": \"deviceSearchQuery\",\n \"rootEntity\": {\n \"entityType\": \"ASSET\",\n \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\"\n },\n \"direction\": \"FROM\",\n \"maxLevel\": 2,\n \"fetchLastLevelOnly\": true,\n \"relationType\": \"Contains\",\n \"edgeTypes\": [\n \"Factory\"\n ]\n}\n```\n\n # Key Filters\nKey Filter allows you to define complex logical expressions over entity field, attribute or latest time series value. The filter is defined using 'key', 'valueType' and 'predicate' objects. Single Entity Query may have zero, one or multiple predicates. If multiple filters are defined, they are evaluated using logical 'AND'. The example below checks that temperature of the entity is above 20 degrees:\n\n```json\n{\n \"key\": {\n \"type\": \"TIME_SERIES\",\n \"key\": \"temperature\"\n },\n \"valueType\": \"NUMERIC\",\n \"predicate\": {\n \"operation\": \"GREATER\",\n \"value\": {\n \"defaultValue\": 20,\n \"dynamicValue\": null\n },\n \"type\": \"NUMERIC\"\n }\n}\n```\n\n Now let's review 'key', 'valueType' and 'predicate' objects in detail.\n\n## Filter Key\n\nFilter Key defines either entity field, attribute or telemetry. It is a JSON object that consists the key name and type. The following filter key types are supported: \n\n * 'CLIENT_ATTRIBUTE' - used for client attributes; \n * 'SHARED_ATTRIBUTE' - used for shared attributes; \n * 'SERVER_ATTRIBUTE' - used for server attributes; \n * 'ATTRIBUTE' - used for any of the above; \n * 'TIME_SERIES' - used for time series values; \n * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; \n * 'ALARM_FIELD' - similar to entity field, but is used in alarm queries only; \n\n\n Let's review the example:\n\n```json\n{\n \"type\": \"TIME_SERIES\",\n \"key\": \"temperature\"\n}\n```\n\n## Value Type and Operations\n\nProvides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: \n\n * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; \n * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; \n * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL;\n * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; \n\n\n## Filter Predicate\n\nFilter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key.\n\nSimple predicate example to check 'value < 100': \n\n```json\n{\n \"operation\": \"LESS\",\n \"value\": {\n \"defaultValue\": 100,\n \"dynamicValue\": null\n },\n \"type\": \"NUMERIC\"\n}\n```\n\nComplex predicate example, to check 'value < 10 or value > 20': \n\n```json\n{\n \"type\": \"COMPLEX\",\n \"operation\": \"OR\",\n \"predicates\": [\n {\n \"operation\": \"LESS\",\n \"value\": {\n \"defaultValue\": 10,\n \"dynamicValue\": null\n },\n \"type\": \"NUMERIC\"\n },\n {\n \"operation\": \"GREATER\",\n \"value\": {\n \"defaultValue\": 20,\n \"dynamicValue\": null\n },\n \"type\": \"NUMERIC\"\n }\n ]\n}\n```\n\nMore complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': \n\n```json\n{\n \"type\": \"COMPLEX\",\n \"operation\": \"OR\",\n \"predicates\": [\n {\n \"operation\": \"LESS\",\n \"value\": {\n \"defaultValue\": 10,\n \"dynamicValue\": null\n },\n \"type\": \"NUMERIC\"\n },\n {\n \"type\": \"COMPLEX\",\n \"operation\": \"AND\",\n \"predicates\": [\n {\n \"operation\": \"GREATER\",\n \"value\": {\n \"defaultValue\": 50,\n \"dynamicValue\": null\n },\n \"type\": \"NUMERIC\"\n },\n {\n \"operation\": \"LESS\",\n \"value\": {\n \"defaultValue\": 60,\n \"dynamicValue\": null\n },\n \"type\": \"NUMERIC\"\n }\n ]\n }\n ]\n}\n```\n\n You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > 'value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or user that is performing the API call. See example below: \n\n```json\n{\n \"operation\": \"GREATER\",\n \"value\": {\n \"defaultValue\": 0,\n \"dynamicValue\": {\n \"sourceType\": \"CURRENT_USER\",\n \"sourceAttribute\": \"temperatureThreshold\"\n }\n },\n \"type\": \"NUMERIC\"\n}\n```\n\n Note that you may use 'CURRENT_USER', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source.\n\nAvailable for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority." operationId: countEntitiesByQuery requestBody: content: application/json: schema: $ref: '#/components/schemas/EntityCountQuery' required: true responses: '200': description: OK content: application/json: schema: type: integer format: int64 /api/edqs/system/request: post: tags: - entity-query-controller operationId: processSystemEdqsRequest requestBody: content: application/json: schema: $ref: '#/components/schemas/ToCoreEdqsRequest' required: true responses: '200': description: OK /api/alarmsQuery/find: post: tags: - entity-query-controller summary: Find Alarms by Query description: "This method description defines how Alarm Data Query extends the Entity Data Query. See method 'Find Entity Data by Query' first to get the info about 'Entity Data Query'.\n\n The platform will first search the entities that match the entity and key filters. Then, the platform will use 'Alarm Page Link' to filter the alarms related to those entities. Finally, platform fetch the properties of alarm that are defined in the **'alarmFields'** and combine them with the other entity, attribute and latest time series fields to return the result. \n\n See example of the alarm query below. The query will search first 100 active alarms with type 'Temperature Alarm' or 'Fire Alarm' for any device with current temperature > 0. The query will return combination of the entity fields: name of the device, device model and latest temperature reading and alarms fields: createdTime, type, severity and status: \n\n```json\n{\n \"entityFilter\": {\n \"type\": \"entityType\",\n \"resolveMultiple\": true,\n \"entityType\": \"DEVICE\"\n },\n \"pageLink\": {\n \"page\": 0,\n \"pageSize\": 100,\n \"textSearch\": null,\n \"searchPropagatedAlarms\": false,\n \"statusList\": [\n \"ACTIVE\"\n ],\n \"severityList\": [\n \"CRITICAL\",\n \"MAJOR\"\n ],\n \"typeList\": [\n \"Temperature Alarm\",\n \"Fire Alarm\"\n ],\n \"sortOrder\": {\n \"key\": {\n \"key\": \"createdTime\",\n \"type\": \"ALARM_FIELD\"\n },\n \"direction\": \"DESC\"\n },\n \"timeWindow\": 86400000\n },\n \"keyFilters\": [\n {\n \"key\": {\n \"type\": \"TIME_SERIES\",\n \"key\": \"temperature\"\n },\n \"valueType\": \"NUMERIC\",\n \"predicate\": {\n \"operation\": \"GREATER\",\n \"value\": {\n \"defaultValue\": 0,\n \"dynamicValue\": null\n },\n \"type\": \"NUMERIC\"\n }\n }\n ],\n \"alarmFields\": [\n {\n \"type\": \"ALARM_FIELD\",\n \"key\": \"createdTime\"\n },\n {\n \"type\": \"ALARM_FIELD\",\n \"key\": \"type\"\n },\n {\n \"type\": \"ALARM_FIELD\",\n \"key\": \"severity\"\n },\n {\n \"type\": \"ALARM_FIELD\",\n \"key\": \"status\"\n }\n ],\n \"entityFields\": [\n {\n \"type\": \"ENTITY_FIELD\",\n \"key\": \"name\"\n }\n ],\n \"latestValues\": [\n {\n \"type\": \"ATTRIBUTE\",\n \"key\": \"model\"\n },\n {\n \"type\": \"TIME_SERIES\",\n \"key\": \"temperature\"\n }\n ]\n}\n```" operationId: findAlarmDataByQuery requestBody: content: application/json: schema: $ref: '#/components/schemas/AlarmDataQuery' required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/PageDataAlarmData' /api/alarmsQuery/count: post: tags: - entity-query-controller summary: Count Alarms by Query (countAlarmsByQuery) description: Returns the number of alarms that match the query definition. operationId: countAlarmsByQuery requestBody: content: application/json: schema: $ref: '#/components/schemas/AlarmCountQuery' required: true responses: '200': description: OK content: application/json: schema: type: integer format: int64 /api/edqs/state: get: tags: - entity-query-controller operationId: getEdqsState responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/EdqsState' components: schemas: NumericFilterPredicate: allOf: - $ref: '#/components/schemas/KeyFilterPredicate' - type: object properties: operation: type: string enum: - EQUAL - NOT_EQUAL - GREATER - LESS - GREATER_OR_EQUAL - LESS_OR_EQUAL value: $ref: '#/components/schemas/FilterPredicateValueDouble' AlarmCountQuery: type: object description: A JSON value representing the alarm count query. properties: startTs: type: integer format: int64 endTs: type: integer format: int64 timeWindow: type: integer format: int64 typeList: type: array items: type: string statusList: type: array items: type: string enum: - ANY - ACTIVE - CLEARED - ACK - UNACK severityList: type: array items: type: string enum: - CRITICAL - MAJOR - MINOR - WARNING - INDETERMINATE searchPropagatedAlarms: type: boolean assigneeId: $ref: '#/components/schemas/UserId' entityFilter: oneOf: - $ref: '#/components/schemas/ApiUsageStateFilter' - $ref: '#/components/schemas/AssetSearchQueryFilter' - $ref: '#/components/schemas/AssetTypeFilter' - $ref: '#/components/schemas/DeviceSearchQueryFilter' - $ref: '#/components/schemas/DeviceTypeFilter' - $ref: '#/components/schemas/EdgeSearchQueryFilter' - $ref: '#/components/schemas/EdgeTypeFilter' - $ref: '#/components/schemas/EntityListFilter' - $ref: '#/components/schemas/EntityNameFilter' - $ref: '#/components/schemas/EntityTypeFilter' - $ref: '#/components/schemas/EntityViewSearchQueryFilter' - $ref: '#/components/schemas/EntityViewTypeFilter' - $ref: '#/components/schemas/RelationsQueryFilter' - $ref: '#/components/schemas/SingleEntityFilter' keyFilters: type: array items: $ref: '#/components/schemas/KeyFilter' EntityViewTypeFilter: allOf: - $ref: '#/components/schemas/EntityFilter' - type: object properties: entityViewType: type: string deprecated: true writeOnly: true entityViewTypes: type: array items: type: string entityViewNameFilter: type: string EdqsState: type: object properties: edqsReady: type: boolean syncStatus: type: string enum: - REQUESTED - STARTED - FINISHED - FAILED apiMode: type: string enum: - ENABLED - AUTO_ENABLED - DISABLED - AUTO_DISABLED PageDataAlarmData: type: object properties: data: type: array description: Array of the entities items: $ref: '#/components/schemas/AlarmData' readOnly: true totalPages: type: integer format: int32 description: Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria readOnly: true totalElements: type: integer format: int64 description: Total number of elements in all available pages readOnly: true hasNext: type: boolean description: '''false'' value indicates the end of the result set' readOnly: true DynamicValueBoolean: type: object properties: sourceType: type: string enum: - CURRENT_TENANT - CURRENT_CUSTOMER - CURRENT_USER - CURRENT_DEVICE sourceAttribute: type: string inherit: type: boolean resolvedValue: type: boolean EntityKey: type: object properties: type: type: string enum: - ATTRIBUTE - CLIENT_ATTRIBUTE - SHARED_ATTRIBUTE - SERVER_ATTRIBUTE - TIME_SERIES - ENTITY_FIELD - ALARM_FIELD key: type: string EntityViewSearchQueryFilter: allOf: - $ref: '#/components/schemas/EntityFilter' - type: object properties: rootEntity: $ref: '#/components/schemas/AliasEntityId' relationType: type: string direction: type: string enum: - FROM - TO maxLevel: type: integer format: int32 fetchLastLevelOnly: type: boolean rootStateEntity: type: boolean defaultStateEntity: $ref: '#/components/schemas/AliasEntityId' entityViewTypes: type: array items: type: string DeviceTypeFilter: allOf: - $ref: '#/components/schemas/EntityFilter' - type: object properties: deviceType: type: string deprecated: true writeOnly: true deviceTypes: type: array items: type: string deviceNameFilter: type: string AliasEntityId: type: object properties: aliasEntityType: type: string enum: - CURRENT_CUSTOMER - CURRENT_TENANT - CURRENT_USER - CURRENT_USER_OWNER id: type: string format: uuid description: ID of the entity, time-based UUID v1 example: 784f394c-42b6-435a-983c-b7beff2784f9 entityType: type: string enum: - TENANT - CUSTOMER - USER - DASHBOARD - ASSET - DEVICE - ALARM - RULE_CHAIN - RULE_NODE - ENTITY_VIEW - WIDGETS_BUNDLE - WIDGET_TYPE - TENANT_PROFILE - DEVICE_PROFILE - ASSET_PROFILE - API_USAGE_STATE - TB_RESOURCE - OTA_PACKAGE - EDGE - RPC - QUEUE - NOTIFICATION_TARGET - NOTIFICATION_TEMPLATE - NOTIFICATION_REQUEST - NOTIFICATION - NOTIFICATION_RULE - QUEUE_STATS - OAUTH2_CLIENT - DOMAIN - MOBILE_APP - MOBILE_APP_BUNDLE - CALCULATED_FIELD - JOB - ADMIN_SETTINGS - AI_MODEL - API_KEY example: DEVICE required: - entityType - id RelationsQueryFilter: allOf: - $ref: '#/components/schemas/EntityFilter' - type: object properties: rootEntity: $ref: '#/components/schemas/AliasEntityId' multiRootEntitiesType: type: string enum: - TENANT - CUSTOMER - USER - DASHBOARD - ASSET - DEVICE - ALARM - RULE_CHAIN - RULE_NODE - ENTITY_VIEW - WIDGETS_BUNDLE - WIDGET_TYPE - TENANT_PROFILE - DEVICE_PROFILE - ASSET_PROFILE - API_USAGE_STATE - TB_RESOURCE - OTA_PACKAGE - EDGE - RPC - QUEUE - NOTIFICATION_TARGET - NOTIFICATION_TEMPLATE - NOTIFICATION_REQUEST - NOTIFICATION - NOTIFICATION_RULE - QUEUE_STATS - OAUTH2_CLIENT - DOMAIN - MOBILE_APP - MOBILE_APP_BUNDLE - CALCULATED_FIELD - JOB - ADMIN_SETTINGS - AI_MODEL - API_KEY multiRootEntityIds: type: array items: type: string uniqueItems: true direction: type: string enum: - FROM - TO filters: type: array items: $ref: '#/components/schemas/RelationEntityTypeFilter' maxLevel: type: integer format: int32 fetchLastLevelOnly: type: boolean negate: type: boolean rootStateEntity: type: boolean defaultStateEntity: $ref: '#/components/schemas/AliasEntityId' multiRoot: type: boolean AvailableEntityKeys: type: object description: Contains unique time series and attribute key names discovered from entities matching a query. Used primarily for UI hints such as autocomplete suggestions. properties: entityTypes: type: array description: Set of entity types found among the matched entities. example: - DEVICE - ASSET items: type: string enum: - TENANT - CUSTOMER - USER - DASHBOARD - ASSET - DEVICE - ALARM - RULE_CHAIN - RULE_NODE - ENTITY_VIEW - WIDGETS_BUNDLE - WIDGET_TYPE - TENANT_PROFILE - DEVICE_PROFILE - ASSET_PROFILE - API_USAGE_STATE - TB_RESOURCE - OTA_PACKAGE - EDGE - RPC - QUEUE - NOTIFICATION_TARGET - NOTIFICATION_TEMPLATE - NOTIFICATION_REQUEST - NOTIFICATION - NOTIFICATION_RULE - QUEUE_STATS - OAUTH2_CLIENT - DOMAIN - MOBILE_APP - MOBILE_APP_BUNDLE - CALCULATED_FIELD - JOB - ADMIN_SETTINGS - AI_MODEL - API_KEY uniqueItems: true timeseries: type: array items: type: string example: temperature uniqueItems: true uniqueItems: true attribute: type: array items: type: string example: serialNumber uniqueItems: true uniqueItems: true required: - attribute - entityTypes - timeseries EntityNameFilter: allOf: - $ref: '#/components/schemas/EntityFilter' - type: object properties: entityType: type: string enum: - TENANT - CUSTOMER - USER - DASHBOARD - ASSET - DEVICE - ALARM - RULE_CHAIN - RULE_NODE - ENTITY_VIEW - WIDGETS_BUNDLE - WIDGET_TYPE - TENANT_PROFILE - DEVICE_PROFILE - ASSET_PROFILE - API_USAGE_STATE - TB_RESOURCE - OTA_PACKAGE - EDGE - RPC - QUEUE - NOTIFICATION_TARGET - NOTIFICATION_TEMPLATE - NOTIFICATION_REQUEST - NOTIFICATION - NOTIFICATION_RULE - QUEUE_STATS - OAUTH2_CLIENT - DOMAIN - MOBILE_APP - MOBILE_APP_BUNDLE - CALCULATED_FIELD - JOB - ADMIN_SETTINGS - AI_MODEL - API_KEY entityNameFilter: type: string CustomerId: type: object properties: id: type: string format: uuid description: ID of the entity, time-based UUID v1 example: 784f394c-42b6-435a-983c-b7beff2784f9 entityType: type: string description: string enum: - CUSTOMER example: CUSTOMER required: - entityType - id EntityId: type: object properties: id: type: string format: uuid description: ID of the entity, time-based UUID v1 example: 784f394c-42b6-435a-983c-b7beff2784f9 entityType: type: string enum: - TENANT - CUSTOMER - USER - DASHBOARD - ASSET - DEVICE - ALARM - RULE_CHAIN - RULE_NODE - ENTITY_VIEW - WIDGETS_BUNDLE - WIDGET_TYPE - TENANT_PROFILE - DEVICE_PROFILE - ASSET_PROFILE - API_USAGE_STATE - TB_RESOURCE - OTA_PACKAGE - EDGE - RPC - QUEUE - NOTIFICATION_TARGET - NOTIFICATION_TEMPLATE - NOTIFICATION_REQUEST - NOTIFICATION - NOTIFICATION_RULE - QUEUE_STATS - OAUTH2_CLIENT - DOMAIN - MOBILE_APP - MOBILE_APP_BUNDLE - CALCULATED_FIELD - JOB - ADMIN_SETTINGS - AI_MODEL - API_KEY example: DEVICE required: - entityType - id RelationEntityTypeFilter: type: object properties: relationType: type: string description: Type of the relation between root entity and other entity (e.g. 'Contains' or 'Manages'). example: Contains entityTypes: type: array description: Array of entity types to filter the related entities (e.g. 'DEVICE', 'ASSET'). items: type: string enum: - TENANT - CUSTOMER - USER - DASHBOARD - ASSET - DEVICE - ALARM - RULE_CHAIN - RULE_NODE - ENTITY_VIEW - WIDGETS_BUNDLE - WIDGET_TYPE - TENANT_PROFILE - DEVICE_PROFILE - ASSET_PROFILE - API_USAGE_STATE - TB_RESOURCE - OTA_PACKAGE - EDGE - RPC - QUEUE - NOTIFICATION_TARGET - NOTIFICATION_TEMPLATE - NOTIFICATION_REQUEST - NOTIFICATION - NOTIFICATION_RULE - QUEUE_STATS - OAUTH2_CLIENT - DOMAIN - MOBILE_APP - MOBILE_APP_BUNDLE - CALCULATED_FIELD - JOB - ADMIN_SETTINGS - AI_MODEL - API_KEY negate: type: boolean description: Negate relation type between root entity and other entity. EntityTypeFilter: allOf: - $ref: '#/components/schemas/EntityFilter' - type: object properties: entityType: type: string enum: - TENANT - CUSTOMER - USER - DASHBOARD - ASSET - DEVICE - ALARM - RULE_CHAIN - RULE_NODE - ENTITY_VIEW - WIDGETS_BUNDLE - WIDGET_TYPE - TENANT_PROFILE - DEVICE_PROFILE - ASSET_PROFILE - API_USAGE_STATE - TB_RESOURCE - OTA_PACKAGE - EDGE - RPC - QUEUE - NOTIFICATION_TARGET - NOTIFICATION_TEMPLATE - NOTIFICATION_REQUEST - NOTIFICATION - NOTIFICATION_RULE - QUEUE_STATS - OAUTH2_CLIENT - DOMAIN - MOBILE_APP - MOBILE_APP_BUNDLE - CALCULATED_FIELD - JOB - ADMIN_SETTINGS - AI_MODEL - API_KEY DynamicValueString: type: object properties: sourceType: type: string enum: - CURRENT_TENANT - CURRENT_CUSTOMER - CURRENT_USER - CURRENT_DEVICE sourceAttribute: type: string inherit: type: boolean resolvedValue: type: string EdgeTypeFilter: allOf: - $ref: '#/components/schemas/EntityFilter' - type: object properties: edgeType: type: string deprecated: true writeOnly: true edgeTypes: type: array items: type: string edgeNameFilter: type: string ComplexFilterPredicate: allOf: - $ref: '#/components/schemas/KeyFilterPredicate' - type: object properties: operation: type: string enum: - AND - OR predicates: type: array items: {} - type: object properties: operation: type: string enum: - AND - OR predicates: type: array items: oneOf: - $ref: '#/components/schemas/BooleanFilterPredicate' - $ref: '#/components/schemas/ComplexFilterPredicate' - $ref: '#/components/schemas/NumericFilterPredicate' - $ref: '#/components/schemas/StringFilterPredicate' SingleEntityFilter: allOf: - $ref: '#/components/schemas/EntityFilter' - type: object properties: singleEntity: $ref: '#/components/schemas/AliasEntityId' FilterPredicateValueString: type: object properties: defaultValue: type: string userValue: type: string dynamicValue: $ref: '#/components/schemas/DynamicValueString' ComparisonTsValue: type: object properties: current: $ref: '#/components/schemas/TsValue' previous: $ref: '#/components/schemas/TsValue' AssetSearchQueryFilter: allOf: - $ref: '#/components/schemas/EntityFilter' - type: object properties: rootEntity: $ref: '#/components/schemas/AliasEntityId' relationType: type: string direction: type: string enum: - FROM - TO maxLevel: type: integer format: int32 fetchLastLevelOnly: type: boolean rootStateEntity: type: boolean defaultStateEntity: $ref: '#/components/schemas/AliasEntityId' assetTypes: type: array items: type: string EntityData: type: object properties: entityId: $ref: '#/components/schemas/EntityId' latest: type: object additionalProperties: type: object additionalProperties: $ref: '#/components/schemas/TsValue' timeseries: type: object additionalProperties: type: array items: $ref: '#/components/schemas/TsValue' aggLatest: type: object additionalProperties: $ref: '#/components/schemas/ComparisonTsValue' FilterPredicateValueDouble: type: object properties: defaultValue: type: number format: double userValue: type: number format: double dynamicValue: $ref: '#/components/schemas/DynamicValueDouble' DynamicValueDouble: type: object properties: sourceType: type: string enum: - CURRENT_TENANT - CURRENT_CUSTOMER - CURRENT_USER - CURRENT_DEVICE sourceAttribute: type: string inherit: type: boolean resolvedValue: type: number format: double EdqsSyncRequest: type: object properties: objectTypes: type: array items: type: string enum: - TENANT - TENANT_PROFILE - CUSTOMER - QUEUE - RPC - RULE_CHAIN - OTA_PACKAGE - RESOURCE - EVENT - RULE_NODE - USER - EDGE - WIDGETS_BUNDLE - WIDGET_TYPE - DASHBOARD - DEVICE_PROFILE - DEVICE - DEVICE_CREDENTIALS - ASSET_PROFILE - ASSET - ENTITY_VIEW - ALARM - ENTITY_ALARM - OAUTH2_CLIENT - OAUTH2_DOMAIN - OAUTH2_MOBILE - USER_SETTINGS - NOTIFICATION_TARGET - NOTIFICATION_TEMPLATE - NOTIFICATION_RULE - ALARM_COMMENT - API_USAGE_STATE - QUEUE_STATS - AUDIT_LOG - RELATION - ATTRIBUTE_KV - LATEST_TS_KV uniqueItems: true EntityDataQuery: type: object description: Entity data query to find entities. Page size is capped at 100. properties: entityFilter: oneOf: - $ref: '#/components/schemas/ApiUsageStateFilter' - $ref: '#/components/schemas/AssetSearchQueryFilter' - $ref: '#/components/schemas/AssetTypeFilter' - $ref: '#/components/schemas/DeviceSearchQueryFilter' - $ref: '#/components/schemas/DeviceTypeFilter' - $ref: '#/components/schemas/EdgeSearchQueryFilter' - $ref: '#/components/schemas/EdgeTypeFilter' - $ref: '#/components/schemas/EntityListFilter' - $ref: '#/components/schemas/EntityNameFilter' - $ref: '#/components/schemas/EntityTypeFilter' - $ref: '#/components/schemas/EntityViewSearchQueryFilter' - $ref: '#/components/schemas/EntityViewTypeFilter' - $ref: '#/components/schemas/RelationsQueryFilter' - $ref: '#/components/schemas/SingleEntityFilter' keyFilters: type: array items: $ref: '#/components/schemas/KeyFilter' pageLink: $ref: '#/components/schemas/EntityDataPageLink' entityFields: type: array items: $ref: '#/components/schemas/EntityKey' latestValues: type: array items: $ref: '#/components/schemas/EntityKey' AlarmDataQuery: type: object description: A JSON value representing the alarm data query. See API call notes above for more details. properties: entityFilter: oneOf: - $ref: '#/components/schemas/ApiUsageStateFilter' - $ref: '#/components/schemas/AssetSearchQueryFilter' - $ref: '#/components/schemas/AssetTypeFilter' - $ref: '#/components/schemas/DeviceSearchQueryFilter' - $ref: '#/components/schemas/DeviceTypeFilter' - $ref: '#/components/schemas/EdgeSearchQueryFilter' - $ref: '#/components/schemas/EdgeTypeFilter' - $ref: '#/components/schemas/EntityListFilter' - $ref: '#/components/schemas/EntityNameFilter' - $ref: '#/components/schemas/EntityTypeFilter' - $ref: '#/components/schemas/EntityViewSearchQueryFilter' - $ref: '#/components/schemas/EntityViewTypeFilter' - $ref: '#/components/schemas/RelationsQueryFilter' - $ref: '#/components/schemas/SingleEntityFilter' keyFilters: type: array items: $ref: '#/components/schemas/KeyFilter' pageLink: $ref: '#/components/schemas/AlarmDataPageLink' entityFields: type: array items: $ref: '#/components/schemas/EntityKey' latestValues: type: array items: $ref: '#/components/schemas/EntityKey' alarmFields: type: array items: $ref: '#/components/schemas/EntityKey' EntityCountQuery: type: object description: A JSON value representing the entity count query. See API call notes above for more details. properties: entityFilter: oneOf: - $ref: '#/components/schemas/ApiUsageStateFilter' - $ref: '#/components/schemas/AssetSearchQueryFilter' - $ref: '#/components/schemas/AssetTypeFilter' - $ref: '#/components/schemas/DeviceSearchQueryFilter' - $ref: '#/components/schemas/DeviceTypeFilter' - $ref: '#/components/schemas/EdgeSearchQueryFilter' - $ref: '#/components/schemas/EdgeTypeFilter' - $ref: '#/components/schemas/EntityListFilter' - $ref: '#/components/schemas/EntityNameFilter' - $ref: '#/components/schemas/EntityTypeFilter' - $ref: '#/components/schemas/EntityViewSearchQueryFilter' - $ref: '#/components/schemas/EntityViewTypeFilter' - $ref: '#/components/schemas/RelationsQueryFilter' - $ref: '#/components/schemas/SingleEntityFilter' keyFilters: type: array items: $ref: '#/components/schemas/KeyFilter' EntityDataPageLink: type: object properties: pageSize: type: integer format: int32 page: type: integer format: int32 textSearch: type: string sortOrder: $ref: '#/components/schemas/EntityDataSortOrder' dynamic: type: boolean PageDataEntityData: type: object properties: data: type: array description: Array of the entities items: $ref: '#/components/schemas/EntityData' readOnly: true totalPages: type: integer format: int32 description: Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria readOnly: true totalElements: type: integer format: int64 description: Total number of elements in all available pages readOnly: true hasNext: type: boolean description: '''false'' value indicates the end of the result set' readOnly: true DeviceSearchQueryFilter: allOf: - $ref: '#/components/schemas/EntityFilter' - type: object properties: rootEntity: $ref: '#/components/schemas/AliasEntityId' relationType: type: string direction: type: string enum: - FROM - TO maxLevel: type: integer format: int32 fetchLastLevelOnly: type: boolean rootStateEntity: type: boolean defaultStateEntity: $ref: '#/components/schemas/AliasEntityId' deviceTypes: type: array items: type: string FilterPredicateValueBoolean: type: object properties: defaultValue: type: boolean userValue: type: boolean dynamicValue: $ref: '#/components/schemas/DynamicValueBoolean' KeyFilterPredicate: discriminator: propertyName: type properties: type: type: string required: - type AlarmData: type: object properties: entityId: $ref: '#/components/schemas/EntityId' latest: type: object additionalProperties: type: object additionalProperties: $ref: '#/components/schemas/TsValue' id: $ref: '#/components/schemas/AlarmId' description: JSON object with the alarm Id. Specify this field to update the alarm. Referencing non-existing alarm Id will cause error. Omit this field to create new alarm. createdTime: type: integer format: int64 description: Timestamp of the alarm creation, in milliseconds example: 1634058704567 readOnly: true tenantId: $ref: '#/components/schemas/TenantId' description: JSON object with Tenant Id readOnly: true customerId: $ref: '#/components/schemas/CustomerId' description: JSON object with Customer Id readOnly: true type: type: string description: representing type of the Alarm example: High Temperature Alarm originator: $ref: '#/components/schemas/EntityId' description: JSON object with alarm originator id severity: type: string description: Alarm severity enum: - CRITICAL - MAJOR - MINOR - WARNING - INDETERMINATE example: CRITICAL acknowledged: type: boolean description: Acknowledged example: true cleared: type: boolean description: Cleared example: false assigneeId: $ref: '#/components/schemas/UserId' description: Alarm assignee user id startTs: type: integer format: int64 description: Timestamp of the alarm start time, in milliseconds example: 1634058704565 endTs: type: integer format: int64 description: Timestamp of the alarm end time(last time update), in milliseconds example: 1634111163522 ackTs: type: integer format: int64 description: Timestamp of the alarm acknowledgement, in milliseconds example: 1634115221948 clearTs: type: integer format: int64 description: Timestamp of the alarm clearing, in milliseconds example: 1634114528465 assignTs: type: integer format: int64 description: Timestamp of the alarm assignment, in milliseconds example: 1634115928465 propagate: type: boolean description: Propagation flag to specify if alarm should be propagated to parent entities of alarm originator example: true propagateToOwner: type: boolean description: Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator example: true propagateToTenant: type: boolean description: Propagation flag to specify if alarm should be propagated to the tenant entity example: true propagateRelationTypes: type: array description: JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. items: type: string originatorName: type: string description: Alarm originator name example: Thermostat originatorLabel: type: string description: Alarm originator label example: Thermostat label originatorDisplayName: type: string description: Originator display name example: Thermostat assignee: $ref: '#/components/schemas/AlarmAssignee' description: Alarm assignee name: type: string description: representing type of the Alarm example: High Temperature Alarm readOnly: true status: type: string description: status of the Alarm enum: - ACTIVE_UNACK - ACTIVE_ACK - CLEARED_UNACK - CLEARED_ACK example: ACTIVE_UNACK readOnly: true details: $ref: '#/components/schemas/JsonNode' required: - acknowledged - cleared - name - originator - severity - status - type AlarmDataPageLink: type: object properties: startTs: type: integer format: int64 endTs: type: integer format: int64 timeWindow: type: integer format: int64 typeList: type: array items: type: string statusList: type: array items: type: string enum: - ANY - ACTIVE - CLEARED - ACK - UNACK severityList: type: array items: type: string enum: - CRITICAL - MAJOR - MINOR - WARNING - INDETERMINATE searchPropagatedAlarms: type: boolean assigneeId: $ref: '#/components/schemas/UserId' pageSize: type: integer format: int32 page: type: integer format: int32 textSearch: type: string sortOrder: $ref: '#/components/schemas/EntityDataSortOrder' dynamic: type: boolean AlarmId: type: object properties: id: type: string format: uuid description: ID of the entity, time-based UUID v1 example: 784f394c-42b6-435a-983c-b7beff2784f9 entityType: type: string description: string enum: - ALARM example: ALARM required: - entityType - id AssetTypeFilter: allOf: - $ref: '#/components/schemas/EntityFilter' - type: object properties: assetType: type: string deprecated: true writeOnly: true assetTypes: type: array items: type: string assetNameFilter: type: string ToCoreEdqsRequest: type: object properties: syncRequest: $ref: '#/components/schemas/EdqsSyncRequest' apiEnabled: type: boolean JsonNode: description: A value representing the any type (object or primitive) examples: - {} ApiUsageStateFilter: allOf: - $ref: '#/components/schemas/EntityFilter' - type: object properties: customerId: $ref: '#/components/schemas/CustomerId' StringFilterPredicate: allOf: - $ref: '#/components/schemas/KeyFilterPredicate' - type: object properties: operation: type: string enum: - EQUAL - NOT_EQUAL - STARTS_WITH - ENDS_WITH - CONTAINS - NOT_CONTAINS - IN - NOT_IN value: $ref: '#/components/schemas/FilterPredicateValueString' ignoreCase: type: boolean KeyFilter: type: object properties: key: $ref: '#/components/schemas/EntityKey' valueType: type: string enum: - STRING - NUMERIC - BOOLEAN - DATE_TIME predicate: oneOf: - $ref: '#/components/schemas/BooleanFilterPredicate' - $ref: '#/components/schemas/ComplexFilterPredicate' - $ref: '#/components/schemas/NumericFilterPredicate' - $ref: '#/components/schemas/StringFilterPredicate' EdgeSearchQueryFilter: allOf: - $ref: '#/components/schemas/EntityFilter' - type: object properties: rootEntity: $ref: '#/components/schemas/AliasEntityId' relationType: type: string direction: type: string enum: - FROM - TO maxLevel: type: integer format: int32 fetchLastLevelOnly: type: boolean rootStateEntity: type: boolean defaultStateEntity: $ref: '#/components/schemas/AliasEntityId' edgeTypes: type: array items: type: string EntityDataSortOrder: type: object properties: key: $ref: '#/components/schemas/EntityKey' direction: type: string enum: - ASC - DESC BooleanFilterPredicate: allOf: - $ref: '#/components/schemas/KeyFilterPredicate' - type: object properties: operation: type: string enum: - EQUAL - NOT_EQUAL value: $ref: '#/components/schemas/FilterPredicateValueBoolean' AlarmAssignee: type: object properties: id: $ref: '#/components/schemas/UserId' firstName: type: string lastName: type: string email: type: string EntityListFilter: allOf: - $ref: '#/components/schemas/EntityFilter' - type: object properties: entityType: type: string enum: - TENANT - CUSTOMER - USER - DASHBOARD - ASSET - DEVICE - ALARM - RULE_CHAIN - RULE_NODE - ENTITY_VIEW - WIDGETS_BUNDLE - WIDGET_TYPE - TENANT_PROFILE - DEVICE_PROFILE - ASSET_PROFILE - API_USAGE_STATE - TB_RESOURCE - OTA_PACKAGE - EDGE - RPC - QUEUE - NOTIFICATION_TARGET - NOTIFICATION_TEMPLATE - NOTIFICATION_REQUEST - NOTIFICATION - NOTIFICATION_RULE - QUEUE_STATS - OAUTH2_CLIENT - DOMAIN - MOBILE_APP - MOBILE_APP_BUNDLE - CALCULATED_FIELD - JOB - ADMIN_SETTINGS - AI_MODEL - API_KEY entityList: type: array items: type: string EntityFilter: discriminator: propertyName: type properties: type: type: string required: - type TenantId: type: object properties: id: type: string format: uuid description: ID of the entity, time-based UUID v1 example: 784f394c-42b6-435a-983c-b7beff2784f9 entityType: type: string description: string enum: - TENANT example: TENANT required: - entityType - id UserId: type: object properties: id: type: string format: uuid description: ID of the entity, time-based UUID v1 example: 784f394c-42b6-435a-983c-b7beff2784f9 entityType: type: string description: string enum: - USER example: USER required: - entityType - id TsValue: type: object properties: ts: type: integer format: int64 value: type: string count: type: integer format: int64 securitySchemes: HTTP login form: type: http description: Enter Username / Password scheme: loginPassword bearerFormat: /api/auth/login|X-Authorization API key form: type: apiKey description: 'Enter the API key value with ''ApiKey'' prefix in format: **ApiKey ** Example: **ApiKey tb_5te51SkLRYpjGrujUGwqkjFvooWBlQpVe2An2Dr3w13wjfxDW**
**NOTE**: Use only ONE authentication method at a time. If both are authorized, JWT auth takes the priority.
' name: X-Authorization in: header