# Attributes
This allows users to define common attribute definitions and reuse them across multiple type def-initions, eliminating the need to repeatedly define the same parameters. This functionality stream-lines workflows, enhances consistency, and optimizes efficiency by enabling users to apply prede-fined attributes within various type definitions.
# GET Query Attribute Definitions
# /definitions/attribute
# Description
Retrieves the list of latest (based on version number) Attribute definitions. The result can be fil-tered by providing the filter parameter. The result can be limited by providing the limit parameter (default is 100). Deleted definitions can be included by setting the includeDeleted parameter to true.
Filterable properties:
- definitionId: string
# Parameters
Name | Located in | Description | Required | Schema |
---|---|---|---|---|
limit | query | Limit the number of returned values. Defaults to 100 if not specified | No | LimitClause |
includeDeleted | query | Whether to return a definition that has been marked as deleted | No | - |
filter | query | A boolean expression used to filter the results | No | WhereClause |
# Responses
Code | Description | Schema |
---|---|---|
200 | A list of attribute definitions. | AttributeValue |
400 | Invalid request. Response will contain details about all encountered validation errors - i.e. request payload too large, malformed JSON, etc | ServiceErrors |
401 | Not Authorized. Either the Access token is missing or the access token valida-tion failed | |
403 | Access Forbidden. Requesting entity does not have enough permissions to access the resource | |
429 | Too many requests - indicates the user has sent too many requests in a given amount of time | ServiceErrors |
500 | Service error. Service has encountered one or more unexpected conditions that prevented it from fulfilling the request, which may or may not be temporary. Response will contain more details about these errors | ServiceErrors |
# POST Create a Attribute Definition
# /definitions/attribute
# Description
Adds a new Attribute definition. It needs to be either a new attributeDefinitionId or the provided ver-sion property needs to conform to the semantic versioning rules for definitions. Otherwise, the re-quest will be rejected. Note that there is NO update of a definition. If changes need to be made, at least a major version increase is required. Therefore, there is also no PUT operation on this endpoint.
# Payload
{
"attributeDefinitionId": "Attributes_Pump",
"version": "1.0.0",
"dataType": "object",
"dataElements": {
"connectionInterface": {
"dataType": "string",
"appliesTo": [
"property"
],
"enum": [
"bluetooth",
"ethernet",
"rs-485"
]
},
"scale": {
"dataType": "integer",
"appliesTo": [
"number",
"integer"
]
}
}
}
# Responses
Code | Description | Schema |
---|---|---|
200 | Creation succeeded. | AttributeValue |
400 | Invalid request. Response will contain details about all encountered validation errors - i.e. request payload too large, malformed JSON, etc | ServiceErrors |
401 | Not Authorized. Either the Access token is missing or the access token valida-tion failed | |
403 | Access Forbidden. Requesting entity does not have enough permissions to access the resource | |
429 | Too many requests - indicates the user has sent too many requests in a given amount of time | ServiceErrors |
500 | Service error. Service has encountered one or more unexpected conditions that prevented it from fulfilling the request, which may or may not be temporary. Response will contain more details about these errors | ServiceErrors |
# GET Retrieve last version of specific Attribute Definition
# /definitions/attribute/{attributeDefinitionId}
# Description
Gets latest (based on its version) Attribute definition based on versions for specific attribute Defi-nitionId. Deleted Attribute definition can also be retrieved by this operation, if the includeDeleted flag is set to true.
# Parameters
Name | Located in | Description | Required | Schema |
---|---|---|---|---|
attributeDefinitionId | path | attributedefinition id | Yes | string |
includeDeleted | query | Whether to return a definition that has been marked as deleted | No | - |
# Responses
Code | Description | Schema |
---|---|---|
200 | Property definition that was found. | feedResponseModelDefinition |
400 | Invalid request. Response will contain details about all encountered validation errors - i.e. request payload too large, malformed JSON, etc | ServiceErrors |
401 | Not Authorized. Either the Access token is missing or the access token valida-tion failed | |
403 | Access Forbidden. Requesting entity does not have enough permissions to access the resource | |
429 | Too many requests - indicates the user has sent too many requests in a given amount of time | ServiceErrors |
500 | Service error. Service has encountered one or more unexpected conditions that prevented it from fulfilling the request, which may or may not be temporary. Response will contain more details about these errors | ServiceErrors |
# DELETE Delete a Attribute Definition
# /definitions/attribute/{attributeDefinitionId}
# Description
Marks the Attribute definition as deleted. No new instances can be created, and no new versions add-ed. The Attribute definition will stay in the database though.
# Parameters
Name | Located in | Description | Required | Schema |
---|---|---|---|---|
attributeDefinitionId | path | attributedefinition id | Yes | string |
# Responses
Code | Description | Schema |
---|---|---|
204 | attributeDefinitioinId successfully marked as deleted. | feedResponseModelDefinition |
400 | Invalid request. Response will contain details about all encountered validation errors - i.e. request payload too large, malformed JSON, etc | ServiceErrors |
401 | Not Authorized. Either the Access token is missing or the access token valida-tion failed | |
403 | Access Forbidden. Requesting entity does not have enough permissions to access the resource | |
429 | Too many requests - indicates the user has sent too many requests in a given amount of time | ServiceErrors |
500 | Service error. Service has encountered one or more unexpected conditions that prevented it from fulfilling the request, which may or may not be temporary. Response will contain more details about these errors | ServiceErrors |
# GET Retrieve list of all versions of specific Attribute Definition
# /definitions/attribute/{attributeDefinitionId}/versions
# Description
Retrieves a list of available versions for the given attributeDefinitionId. To retrieve the versions of a soft-deleted definition the includeDeleted flag has to be set to "true".
# Parameters
Name | Located in | Description | Required | Schema |
---|---|---|---|---|
attributeDefinitionId | path | attributedefinition id | Yes | string |
includeDeleted | query | Whether to return a definition that has been marked as deleted | No | - |
# Responses
Code | Description | Schema |
---|---|---|
200 | Attribute definition that was found. | feedResponseModelDefinition |
400 | Invalid request. Response will contain details about all encountered validation errors - i.e. request payload too large, malformed JSON, etc | ServiceErrors |
401 | Not Authorized. Either the Access token is missing or the access token valida-tion failed | |
403 | Access Forbidden. Requesting entity does not have enough permissions to access the resource | |
429 | Too many requests - indicates the user has sent too many requests in a given amount of time | ServiceErrors |
500 | Service error. Service has encountered one or more unexpected conditions that prevented it from fulfilling the request, which may or may not be temporary. Response will contain more details about these errors | ServiceErrors |
# GET Retrieves the specific version of specific Attribute Definition
# /definitions/attribute/{attributeDefinitionId}/versions/{versions}
# Description
Retrieves a specific AttributeDefinition identified by Attribute definition id and version. Full version only, e.g.: .../versions/1.0.0
# Parameters
Name | Located in | Description | Required | Schema |
---|---|---|---|---|
attributeDefinitionId | path | attributedefinition id | Yes | string |
version | path | (Partial) version number | Yes | string |
includeDeleted | query | Whether to return a definition that has been marked as deleted | No | - |
# Responses
Code | Description | Schema |
---|---|---|
200 | Attribute definition that was found. | feedResponseModelDefinition |
400 | Invalid request. Response will contain details about all encountered validation errors - i.e. request payload too large, malformed JSON, etc | ServiceErrors |
401 | Not Authorized. Either the Access token is missing or the access token valida-tion failed | |
403 | Access Forbidden. Requesting entity does not have enough permissions to access the resource | |
429 | Too many requests - indicates the user has sent too many requests in a given amount of time | ServiceErrors |
500 | Service error. Service has encountered one or more unexpected conditions that prevented it from fulfilling the request, which may or may not be temporary. Response will contain more details about these errors | ServiceErrors |
# How to reuse complex Attribute Definitions in Type Definition
# Description
In TypeDefinitions and Extensions for attribute components, Attribute Definitions can be reused. Be-fore utilizing in TypeDefinition or Extensions, attribute definitions must be created.
Reuse in TD
{
"typeId": "my.typeA",
"model": "abb.ability.device",
"version": "1.0.0",
"properties": {
"weight": {
"dataType": "number",
"description": "Physical mass of the object",
"connectionInterface": "bluetooth",
"scale": 100
}
},
"attributes": {
"attributeDefinitionId": [
"Attributes_Pump@1"
]
}
}
Reuse in extensions
{
"attributes": {
"attributeDefinitionId": ["Attributes_Pump@1"]
},
"atr1": {
"dataType": "string",
"appliesTo": "number"
}
}