Skip to content

Powered by Grav CMS + Helios Theme

Product labels

A product's EU energy labels and label images, such as a warranty badge.

A product's labels in display order: EU energy labels and image labels such as a warranty badge. The files are product media, uploaded first with the role label and then named here by id.

List product labels

GET /api/v1/kahunacart/products/{id}/labels Permission kahunacart.products.manage

A product's labels in display order: EU energy labels and image labels such as a warranty badge. Each carries its kind (energy or image), the energy class and scale, its title, the variant it is limited to (null for every variant), its position, the full label image, the small image, the product information sheet, and for an energy label the class arrow as inline SVG.

Parameters

Name Type Description
id required integer Product id

Add a label to a product

POST /api/v1/kahunacart/products/{id}/labels Permission kahunacart.products.manage

Add an EU energy label or an image label (a warranty badge, a certification). The files are product media uploaded first with role label and named here by id; uploading bytes is not available through this interface. An energy label needs its class on its scale (A-G unless said otherwise; A+++-D, A++-E and A+-F for the older labels) and its full label image, and may carry the product information sheet as a PDF; its small image is the class arrow and is drawn for it. An image label needs a title and its full image, and may carry a small image. A refusal is a 422 saying what is wrong.

Parameters

Name Type Description
id required integer Product id
kind required string
One of: energy, image
energy_class optional string The class letter, such as C or A++. Energy labels only
energy_scale optional string
One of: A-G, A+++-D, A++-E, A+-F
Default: A-G
title optional string or null What a screen reader says for it, such as "2-year warranty". Required on an image label
variant_id optional integer or null Limit the label to one variant of this product; null for every variant
position optional integer At least 0.
image_media_id required integer The full label: an image uploaded to this product with role label
thumb_media_id optional integer or null An image label's small image, uploaded with role label; null to use the full image scaled down
document_media_id optional integer or null An energy label's product information sheet: a PDF uploaded with role label

Update a product label

PATCH /api/v1/kahunacart/products/{id}/labels/{labelId} Permission kahunacart.products.manage

Change a label's energy class and scale, title, variant, position or the files it names. The kind is fixed. A file swapped out is deleted once no other label uses it.

Parameters

Name Type Description
id required integer Product id
labelId required integer Product label id
energy_class optional string
energy_scale optional string
One of: A-G, A+++-D, A++-E, A+-F
title optional string or null 190 characters or fewer.
variant_id optional integer or null
position optional integer At least 0.
image_media_id optional integer
thumb_media_id optional integer or null
document_media_id optional integer or null

Delete a product label

DELETE /api/v1/kahunacart/products/{id}/labels/{labelId} Permission kahunacart.products.manage

Remove a label from its product, and delete its files from disk unless another label uses them.

Parameters

Name Type Description
id required integer Product id
labelId required integer Product label id

An energy label needs its class on its scale, A-G unless said otherwise (A+++-D, A++-E and A+-F for the older labels), and its full label image. It may carry the product information sheet as a PDF. Its small image is the class arrow, and it is drawn for the label. An image label needs a title and its full image, and may carry a small image. The create route takes JSON naming files already uploaded with role=label, or multipart/form-data carrying them as image, thumb and document. The MCP tool takes the JSON form only, because it can't upload bytes. A refusal is a 422 saying what is wrong.