Attributes & Sets
The following four items will be discussed within the scope of product attributes.
Attribute
AttributeSet
AttributeConfig
AttributeValue
During the initial installation of Omnitron, product attributes, namely Attribute values, are created before the products themselves. AttributeSet values are created to keep these attribute values together. AttributeConfigs are then added to link Attributes and AttributeSets. Attributes and AttributeSets are linked completely through AttributeConfig, as there is no direct relation between them. Finally, an AttributeValue is added for each Attribute.
1. Attribute
Indicates product attributes. Product properties, such as size, color, etc. are called Attributes. Attributes AttributeInputTypes {omnicore.products.enums.AttributeInputTypes} can have the following types: text, boolean, dropdown etc. Attribute values of products not productized are controlled with the pre_attribute: bool value, while the attribute values of a product marked as pre_product will be pre_attibute=True. Attribute objects are multilingual and can be localized.
2. AttributeSet
Multiple Attributes form an AttributeSet. For example, the size and color of a product created for clothing will be the AttributeSet collectively belonging to the clothing products. AttributeSet may be of two different types: simple and grouped, as specified in AttributeSetType {omnicore.products.enums.AttributeSetTypes}.
3. AttributeConfig
AttributeConfig is a bridge between Attribute and AttributeSet, and singular between the two properties. It means that there can only be one AttributeConfig between Attribute and AttributeSet.
4. AttributeValue
Values of the product’s attributes. If a garment size is Attribute, sizes such as X, M, L and XL are AttributeValue. AttributeValue objects are multilingual and can be localized.
GET Attributes
GET AttributesPath: /api/v1/attributes/
Brings the attribute values from the Attribute table. Gets the filter parameters with {omnitron.products.resources.filters.AttributeFilter} in AttributeFilter as query parameters. Supports pagination with ViewSet’s inheritance from ListModelMixin with query parameters of page=X and limit=Y.
AttributeFilter
Used in listing operations with GET used in AttributeViewSet. It can get the following parameters as a filter.
data_type: Contains Attribute type, takes AttributeInputTypes enum values. It allows multiple selections. E.g: /?data_type=X&data_type=Y
key: The code for the Attribute, requires an exact match.
name:The namespace for the Attribute. It only needs to contain this value and works as case-sensitive.
is_required: Takes True/False value.
is_searchable: Takes True/False value.
is_variant: Takes True/False value.
is_variant_listable: Takes True/False value.
is_visible: Takes True/False value.
Attribute API Methods
GET Attributes by Attribute Data Type
GET Attributes by Attribute Data TypePath: api/v1/attributes/?data_type=text/
POST Create Attribute
POST Create AttributePath: api/v1/attributes/
Adds a new record to the Attribute table. It is validated with AttributeSerializer. If the data is not suitable, it returns HTTP400. If there is an error or non-compliance in the service layer during the recording process, it returns HTTP406.
Response
Errors
DELETE Attribute
DELETE AttributePath: /api/v1/attributes/{pk}/
Deletes the object of the relevant primary key from the Attribute table. If it cannot find the object, it returns HTTP404.
Response
HTTP204
GET Attribute
GET AttributePath: /api/v1/attributes/{pk}/
Gets the object of the relevant primary key from the Attribute table. If it cannot find the object, it returns HTTP404.
Response
PATCH Update Attribute
PATCH Update AttributePath: /api/v1/attributes/{pk}/
Partially updates the object of the relevant primary key from the Attribute table. It is validated with AttributeSerializer. If the data is not suitable, it returns HTTP400. If it cannot find the object, it returns HTTP404. With a partial update behavior, it only updates the sent parameters.
Body
Response
Errors
PUT Update Attribute
PUT Update AttributePath: /api/v1/attributes/{pk}/
Updates the object of the relevant primary key from the Attribute table. It is validated with AttributeSerializer. If the data is not suitable, it returns HTTP400. If it cannot find the object, it returns HTTP404. With an update behavior, it updates the entire object.
GET Attributes Details
GET Attributes DetailsPath: /api/v1/attributes/detailed/
Exhibits the same behavior as Attribute listing, but the return parameters are more detailed. The data_type and visible_values fields are retrieved in detail.
Response
GET Attribute Detail
GET Attribute DetailPath: /api/v1/attributes/{pk}/detailed/
Exhibits the same behavior as getting Attributes, but the return parameters are more detailed. The data_type and visible_values fields are retrieved in detail.
Response
GET Attribute Translations
GET Attribute TranslationsPath: /api/v1/attributes/{pk}/translations/
Brings the recorded localization values for the Attribute. Only the "name" parameter can be localized for the Attribute.
Response
Attribute Set API Methods
GET Attribute Sets
GET Attribute SetsPath: /api/v1/attribute_set/
Brings the attribute values from the AttributeSet table. Gets the filter parameters in AttributeSetFilter {omnitron.products.resources.filters.AttributeSetFilter} as query parameters. Supports pagination with ViewSet’s inheritance from ListModelMixin with query parameters of page=X and limit=Y.
AttributeSetFilter
Used in listing operations with GET used in AttributeSetViewSet. It can get the following parameters as a filter.
attribute_set_type: Contains AttributeSet type, takes AttributeSetTypes enum values.
name: The namespace for the AttributeSet. It only needs to contain this value and works as case-sensitive.
GET Attribute Sets by Attribute Set Type
GET Attribute Sets by Attribute Set TypeFilters can be used with GET requests as follows.
Path: api/v1/attribute_set/?attribute_set_type=simple/
Response
POST Create Attribute Set
POST Create Attribute SetPath: /api/v1/attribute_set/
Adds a new record to the AttributeSet table. It is validated with AttributeSetSerializer. If the data is not suitable, it returns HTTP400. If there is an error or non-compliance in the service layer during the recording process, it returns HTTP406.
Response
Errors
DELETE Attribute Set
DELETE Attribute SetPath: /api/v1/attribute_set/{pk}/
Deletes the object of the relevant primary key from the AttributeSet table. If it cannot find the object, it returns HTTP404.
Response: HTTP204
GET Attribute Set
GET Attribute SetPath: /api/v1/attribute_set/{pk}/
Gets the object of the relevant primary key from the AttributeSet table. If it cannot find the object, it returns HTTP404.
Response
PATCH Update Attribute Set
PATCH Update Attribute SetPath: /api/v1/attribute_set/{pk}/
Partially updates the object of the relevant primary key from the AttributeSet table. It is validated with AttributeSetSerializer. If the data is not suitable, it returns HTTP400. If it cannot find the object, it returns HTTP404. With a partial update behavior, it only updates the sent parameters.
Body
Response
HTTP 200
Errors
PUT Update Attribute Set
PUT Update Attribute SetPath: /api/v1/attribute_set/{pk}/
Updates the object of the relevant primary key from the AttributeSet table. It is validated with AttributeSetSerializer. If the data is not suitable, it returns HTTP400. If it cannot find the object, it returns HTTP404. With an update behavior, it updates the entire object.
Body
Response
HTTP 200
Errors
GET Attribute Sets Details
GET Attribute Sets DetailsPath: /api/v1/attribute_set/detailed/
Exhibits the same behavior as AttributeSet listing, but the return parameters are more detailed. It also gets individual Attribute values in "attributeconfig_set."
Response:
GET Attribute Set Detail by Attribute Set Type
GET Attribute Set Detail by Attribute Set TypePath: api/v1/attribute_set/detailed/?attribute_set_type=simple/
Response
GET Attribute Set Detail
GET Attribute Set DetailPath: /api/v1/attribute_set/{pk}/detailed/
Exhibits the same behavior as getting AttributeSets, but the return parameters are more detailed. It also gets individual Attribute values in "attributeconfig_set."
Response
Attribute Config API Methods
GET Attribute Configs
GET Attribute ConfigsPath: /api/v1/attribute_config/
Gets the values in the AttributeConfig table. Gets the filter parameters with {omnitron.products.resources.filters.AttributeConfigFilter} in AttributeConfigFilter as query parameters. Supports pagination with ViewSet’s inheritance from ListModelMixin with query parameters of page=X and limit=Y.
AttributeConfigFilter
Used in listing operations with GET used in AttributeConfigViewSet. It can get the following parameters as a filter.
attribute: pk value of the relevant Attribute object.
attribute_set: pk value of the relevant AttributeSet object.
GET Attribute Config by Attribute
GET Attribute Config by AttributePath: api/v1/attribute_config/?attribute={pk}
Response
POST Create Attribute Config
POST Create Attribute ConfigPath: /api/v1/attribute_config/
Adds a new record to the AttributeConfig table. It is validated with AttributeConfigSerializer. If the data is not suitable, it returns HTTP400. If there is an error or non-compliance in the service layer during the recording process, it returns HTTP406.
Body
Response
Errors
DELETE Attribute Config
DELETE Attribute ConfigPath: /api/v1/attribute_config/{pk}/
Deletes the object of the relevant primary key from the AttributeConfig table. If it cannot find the object, it returns HTTP404.
Response: HTTP204
GET Attribute Config
GET Attribute ConfigPath: /api/v1/attribute_config/{pk}/
Gets the object of the relevant primary key from the AttributeSet table. If it cannot find the object, it returns HTTP404.
Response
PATCH Update Attribute Config
PATCH Update Attribute ConfigPath: /api/v1/attribute_config/{pk}/
Partially updates the object of the relevant primary key from the AttributeConfig table. It is validated with AttributeConfigSerializer. If the data is not suitable, it returns HTTP400. If it cannot find the object, it returns HTTP404. With a partial update behavior, it only updates the sent parameters.
Body
Response
Errors
PUT Update Attribute Config
PUT Update Attribute ConfigPath /api/v1/attribute_config/{pk}/
Updates the object of the relevant primary key from the AttributeConfig table. It is validated with AttributeConfigSerializer. If the data is not suitable, it returns HTTP400. If it cannot find the object, it returns HTTP404. With an update behavior, it updates the entire object.
Body
Response
Errors
GET Attribute Configs Details
GET Attribute Configs DetailsPath: /api/v1/attribute_config/detailed/
Exhibits the same behavior as AttributeSet listing, but the return parameters are more detailed. Gets the associated attribute value in detail.
Response
GET Attribute Config Detail
GET Attribute Config DetailPath: /api/v1/attribute_config/{pk}/detailed/
Exhibits the same behavior as getting AttributeConfigs, but the return parameters are more detailed. Gets the associated attribute value in detail.
Response
Attribute Value API Methods
GET Attribute Values
GET Attribute ValuesPath: /api/v1/attribute_value/
Gets the values in the AttributeValue table. Gets the filter parameters in AttributeValueFilter {omnitron.products.resources.filters.AttributeValueFilter} as query parameters. Supports pagination with ViewSet’s inheritance from ListModelMixin with query parameters of page=X and limit=Y.
AttributeValueFilter
Used in listing operations with GET used in AttributeValueViewSet. It can get the following parameters as a filter.
label: The title field for the AttributeValue. It only needs to contain this value and works as case-sensitive.
erp_code: The erp code field for the AttributeValue. It only needs to contain this value.
value: The value field for the AttributeValue. It only needs to contain this value.
value__exact: The value field for the AttributeValue. It requires a complete match.
attribute: pk value of the relevant Attribute object.
Response
POST Create Attribute Value
POST Create Attribute ValuePath: /api/v1/attribute_value/
Adds a new record to the AttributeValue table. It is validated with AttributeValueSerializer. If the data is not suitable, it returns HTTP400. If there is an error or non-compliance in the service layer during the recording process, it returns HTTP406.
Response
Errors
GET Attribute Value
GET Attribute ValuePath: /api/v1/attribute_value/{pk}/
Gets the object of the relevant primary key from the AttributeValue table. If it cannot find the object, it returns HTTP404.
Response
PATCH Update Attribute Value
PATCH Update Attribute ValuePath: /api/v1/attribute_value/{pk}/
Partially updates the object of the relevant primary key from the AttributeValue table. It is validated with AttributeValueSerializer. If the data is not suitable, it returns HTTP400. If it cannot find the object, it returns HTTP404. With a partial update behavior, it only updates the sent parameters.
Body
Response
Errors
PUT Update Attribute Value
PUT Update Attribute ValuePath: /api/v1/attribute_value/{pk}/
Updates the object of the relevant primary key from the AttributeValue table. It is validated with AttributeValueSerializer. If the data is not suitable, it returns HTTP400. If it cannot find the object, it returns HTTP404. With an update behavior, it updates the entire object.
Body
Response
Errors
DELETE Attribute Value
DELETE Attribute ValuePath: /api/v1/attribute_value/{pk}/
Deletes the object of the relevant primary key from the AttributeConfig table. If it cannot find the object, it returns HTTP404.
Response: HTTP204
GET Attribute Values Details
GET Attribute Values DetailsPath: /api/v1/attribute_value/detailed/
Exhibits the same behavior as AttributeValue listing, but the return parameters are more detailed. Gets the associated attribute value in detail.
Response
GET Attribute Value Detail
GET Attribute Value DetailPath: /api/v1/attribute_value/{pk}/detailed/
Exhibits the same behavior as getting AttributeValue, but the return parameters are more detailed. Gets the associated attribute value in detail.
Response
GET Attribute Value Translations
GET Attribute Value TranslationsPath: /api/v1/attribute_value/{pk}/translations/
Brings the recorded localization values for the AttributeValue. Only the "label" parameter can be localized for the AttributeValue.
Response
Last updated
Was this helpful?

