Glue API: Retrieve product labels

Edit on GitHub

Product labels are used to draw your customers’ attention to some specific products. Each of them has a name, a priority, and a validity period. The Product Labels API provides endpoints for getting labels via the REST HTTP requests.

Installation

For detailed information on the modules that provide the API functionality and related installation instructions, see Install the Product Labels Glue API.

Retrieve a product label

To retrieve a product label, send the request:


GET /product-labels/{{product_label_id}}


PATH PARAMETER DESCRIPTION
{{product_label_id}} ID of a product label to retrieve. You can check it in the Back Office > Products > Product Labels

Request

Request sample: retrieve a product label

GET http://glue.mysprykershop.com/product-labels/3

Response

Response sample: retrieve a product label
{
    "data": {
        "type": "product-labels",
        "id": "3",
        "attributes": {
            "name": "Standard Label",
            "isExclusive": false,
            "position": 3,
            "frontEndReference": ""
        },
        "links": {
            "self": "http://glue.mysprykershop.com/product-labels/3"
        }
    }
}
RESOURCE ATTRIBUTE TYPE DESCRIPTION
product-labels name String Specifies the label name.
product-labels isExclusive Boolean Indicates whether the label is exclusive.
If the attribute is set to true, the current label takes precedence over other labels the product might have. This means that only the current label should be displayed for the product, and all other possible labels should be hidden.
product-labels position Integer Indicates the label priority.
Labels should be indicated on the frontend according to their priority, from the highest (1) to the lowest, unless a product has a label with the isExclusive attribute set.
product-labels frontEndReference String Specifies the label custom label type (CSS class).
If the attribute is an empty string, the label should be displayed using the default CSS style.

Other management options

Apart from using this dedicated endpoint, you can retrieve product lables as an included resource as follows:

Possible errors

CODE REASON
1201 Label with the specified ID does not exist.
1202 Product label ID is not specified.

To view generic errors that originate from the Glue Application, see Reference information: GlueApplication errors.