Product Variants Type Service
Overview
Product Variants Type stores the available attribute values for a product's variants
(e.g. the selectable options within a given type, such as Midnight Blue, Crimson Red, Forest Green for a Colour type).
Each record links:
- a product (
Product Id) — the product it belongs to - a system type (
System Type Id) — the attribute type it belongs to (e.g. a dimension) - a value (
Value) — the raw value (e.g.#191970) - a display value (
Display Value) — the human-readable label (e.g.Midnight Blue)
These values are referenced by ProductVariantsAttributes
to describe the attributes that characterise each variant (e.g. its selected options per type).
All operations are tenant-aware and scoped to the current tenant.
Endpoints
GET
/api/v1/ProductVariantsType/product/{productId}
Returns all variants type values for a given product.
Behavior:
- Returns records ordered by
System Type IdthenSort Order - Includes the system type name via navigation property (
System Type Name) - Returns
404if no records exist for the product
Authorization:
- No authentication required
GET
/api/v1/ProductVariantsType/{id}
Returns a single variants type record by its identifier.
Behavior:
- Looks up record by
Id - Includes the system type name via navigation property
- Returns
404if the record does not exist
Authorization:
- No authentication required
POST
/api/v1/ProductVariantsType
Creates a new product variants type value.
Request body:
Product Id(long, required) - the product this value belongs toSystem Type Id(int, required) - the system type (dimension) being describedValue(string, required) - raw value (e.g. hex code, ISO code)Display Value(string, optional) - human-readable labelSort Order(int, optional) - display order within the dimension
Behavior:
- Validation is handled in the service layer
- Successful creation writes an audit log entry
Errors:
- Returns
400if validation fails
Authorization:
- Requires Bearer Token
PUT
/api/v1/ProductVariantsType/{id}
Updates an existing variants type value.
Request:
- Record ID is taken from the route
- Body must include:
Id(long, required)Product Id(long, required)System Type Id(int, required)Value(string, required)
- Optional:
Display Value(string)Sort Order(int)
Behavior:
- All provided fields overwrite existing values
Product Idcannot be changed via update- Successful update writes an audit log entry
Errors:
- Returns
400if validation fails or record does not exist
Authorization:
- Requires Bearer Token
DELETE
/api/v1/ProductVariantsType/{id}
Deletes a variants type value by its identifier.
Behavior:
- Performs a hard delete
- Record is permanently removed from the database
- Successful deletion writes an audit log entry
Errors:
- Returns
400if record does not exist or deletion fails
Authorization:
- Requires Bearer Token
Notes
- Validation is enforced in the service layer, not via model attributes
System Type Nameis read-only and resolved from theProductSystemTypesnavigation property- Deleting a value may affect
ProductVariantsAttributesrecords that reference it - All state-changing operations are audited
- Internal errors are logged but not exposed to clients