Attributes
Attributes are resources custom defined fields which can be created manually via the Propeller Backoffice or imported via the REST API. Attributes are a powerful and flexible mechanism which are usually used to define products' specification. Another use case is when Propeller's resource pre defined properties are simply not sufficient. Attribute resource values can be inherited from their parent resource. For example, if a product attribute is set on a category, that attribute will be inherited on all products under that category, unless the attribute is set on the product itself.
Attribute Lookup keys
Key | Type | Description |
---|---|---|
id | integer | Propeller attribute id, auto-generated |
name | string | the name of the attribute. Attribute name can contain any alphanumeric uppercase character and _ . |
Fields
Name | Description | Type |
---|---|---|
name | User friendly attribute identifier. Name is unique per attribute class . Can contain any alphanumeric uppercase character and _ . Cannot be updated after attribute is created. | string |
class | The type of resource for which the attribute will be used. Cannot be updated after attribute is created. Possible values are product , category , user . user is used for both users and usergroups resources. | string |
isPublic | Boolean value. Indicates whether attribute will be publicly available or only within Propeller backoffice. | boolean Default value is true |
isSearchable | Boolean value. It is used only for attributes class product . Indicates whether attribute values will be indexed and available for searching. | boolean Default value is false |
isSystem | Boolean value. Special custom usage. System attributes are not visible in the resource Attribute tab in Propeller backoffice. | boolean Default value is false |
isHidden | Boolean value. Special custom usage. Hidden attributes are not visible in the resource Attribute tab in Propeller backoffice. Default value is false . | boolean Default value is false |
type | Type of the value. Cannot be updated after attribute is created. Possible values are text , list , enum , enumlist , integer , decimal , date , datetime . list is a multi value attribute with comma delimited list of values. enum is a single value attribute. The possible values are predefined in a valueset. enumlist is a multi-value attribute. The value is a comma delimited list of values predefined in a valueset. | string |
typeParam (string) | Used in combination with type enum and enumlist . The name of the valueset that holds all possible values. | string |
descriptions | Attribute description/ label. | array[LocalizedString] |
value | Attribute default value/ resource value. Possible values depend on type | array[LocalizedString] (text , list ) string ( enum , enumlist ) integer decimal date datetime |
units | Attribute unit. Ex. use case: If an attribute is a type of measurement like weight or height, the unit will be kg or cm, etc. | array[LocalizedString] |
group | Attributes are sometimes related to each other. group is used to link them. | string |
Attribute Errors
This section describes error codes specific for the Attribute
resource.
Code | Error Type | Status Code | Message | Reason |
---|---|---|---|---|
14001 | AttributeNotFound | 404 | Attribute does not exist | Attribute with such lookup key already exists |
14002 | AttributeMultipleFound | 400 | Multuple attributes found. Please provide additional filters | Multiple attributes with such lookup key found. Provide additional filters |
14003 | AttributeExists | 400 | Attribute already exists | Attribute with such name already exists |
14004 | AttributeInvalidClass | 400 | No attributes defined for class | Attributes for resources of the provided class are not configured |
14005 | AttributeInvalidValue | 400 | Invalid value provided | The attribute value does not correspond with the attribute type |
📄️ Get attributes
This endpoint can be used to list all existing attributes. Results will be [paginated](/rest-sonar/api-reference#pagination). The default number of attributes per page is `12`, but can be up to `100`.
📄️ Create attribute
Before setting an attribute value for a specific resource, the attribute definition needs to be created. This endpoint is used to create a single attribute definition.
📄️ Get attribute by lookup key
This endpoint is used to retrieve details of an attribute. The attribute is identified by it's Propeller Id or name. The `attributeClass` Query Param is useful to use when the same attribute name is used for an attribute with a different class.
📄️ Delete attribute by lookup key
This endpoint is used to delete an attribute. The attribute is identified by it's Propeller Id or name. The `attributeClass` Query Param is useful to use when the same attribute name is used for an attribute with a different class.
📄️ Update attribute by lookup key
This endpoint enables updating the definition of an attribute. The attribute is identified by it's Propeller Id or name. The `attributeClass` Query Param is useful to use when the same attribute name is used for an attribute with a different class.
📄️ Bulk attributes by Id
Before setting an attribute value for a specific resource, the attribute definition needs to be created. Usually, multiple attributes need to be created or updated at the same time which is useful to eliminate a lot of API requests. This endpoint is used for bulk processing of attribute definitions based on an Id.
📄️ Bulk attributes by name
Before setting an attribute value for a specific resource, the attribute definition needs to be created. Usually, multiple attributes need to be created or updated at the same time which is useful to eliminate a lot of API requests. This endpoint is used for bulk processing of attribute definitions based on the name.
📄️ Search attributes
Retrieves a list of attributes by using the search fields below:
📄️ Get resource attributes by resource lookup key
Retrieves all attributes for a resource identified by its [lookup key](/rest-sonar/attributes#attribute-lookup-keys). Results will be [paginated](/rest-sonar/api-reference#pagination). The default number of attributes per page is `12`, but can be up to `100`.
📄️ Bulk resource attribute values by resource lookup key
The bulk resource attribute endpoint sets/ deletes resource attributes for a single resource identified by the [lookup key](/rest-sonar/attributes#attribute-lookup-keys). The attribute is identified via the payload by providing either `id` or `name`. If both are provided, `id` will be used to identify the attribute. Below is a summary of all the possible fields in the payload.
📄️ Get resource attribute by resource lookup key and attribute lookup key
Retrieves a specific attribute for a resource identified by resource [lookup key](/rest-sonar/attributes#attribute-lookup-keys) and [attribute lookup key](/rest-sonar/attributes#attribute-lookup-keys). The `attributeClass` Query Param is useful to use when the attribute lookup key is `name` and the same attribute name is used for an attribute with a different class.