docs
  1. SCAYLE Resource Center
  2. Developer Guides
  3. Products
  4. Manage Brands

Manage Brands

General

A brand attribute group is already created during the integration phase by default.
Its purpose is to identify brands like NIKE. Furthermore, a brand entity is available for special front-end purposes. Although you do not need to work with brands, we recommend using them to highlight brands on special landing pages or when creating thematic overviews, e.g., sustainable brands.

Brand Groups

You can also combine individual brands into brand groups, e.g., for bundling sub-brands or thematic brands.

Custom Data

This entity supports custom data, please check the documentation at Custom Data.

Admin API

Create a brand

When creating a brand, you can already add a logo, define a related brand group, or attach other information with attributes so you can conveniently cluster brands at a later time in the front end.

This method is used to create a new brand.

Attributes

It is possible to specify a set of attributes, which will be either linked to the brand if they already exist or created and subsequently linked to the brand. The attribute's name must refer to an attribute group of the brand level.

Method Signature

let response = await adminApi.apis.Brands.createBrand({}, {requestBody: brand});
let brand = response.body;

If there exists a custom data configuration for the brand entity and the custom data isn't provided within the create request, the defaultValue specified in the custom data configuration for each property would be considered. Otherwise, if the custom data is not provided in either the payload, or in the configuration as defaultValue, the entity can not be created or updated.

Parameters

ParameterTypeDescription
idintegerThe ID of the brand created by SCAYLE. READ-ONLY
namestringName of the brand.
groupstringGroup name allowing to group different brands.
logoUrlstringURL of the image, either manually specified or generated by SCAYLE, if the SCAYLE CDN is used.
logoSourceAssetSourceA source specifying where to download the logo from.
attributesAttributeA list of attributes attached to the brand.
customDataCustomDataArbitrary fields assigned to Brands.
let newBrand = {
  name: "MyBrand",
  group: "Sustainable",
  logoUrl: "https://mybrand.com/logo.png"
};

let response = await adminApi.apis.Brands.createBrand({}, {requestBody: newBrand});
let createdBrand = response.body;

console.log(createdBrand.id);

Create a Brand with Attributes

let newBrand = {
  name: "MyBrand",
  attributes: [
    {
      name: "sustainable",
      type: "simple",
      value: "Y"
    }
  ]
};

let response = await adminApi.apis.Brands.createBrand({}, {requestBody: newBrand});
let createdBrand = response.body;

console.log(createdBrand.id);

Update brands

Learn how to update a brand.

You can update brand information by providing the respective attributes with new values to replace the old ones.

This method can be used to update or replace an existing brand.

This method does not support partial updates.

let response = await adminApi.apis.Brands.updateBrand({brandId: brandId},{requestBody: brand});
let brand = response.body;

In general, this method replaces the brand with the provided information. Unprovided properties will get deleted except for attributes and custom data as stated below.

Attributes

  • If attributes are not provided, they will NOT get deleted.
  • If attributes are provided, they will be replaced by the provided information. The provided attributes will be either linked to the brand if they already exist or created and subsequently linked to the brand. The attribute's name must refer to an attribute group of the brand level.
  • If attributes are provided and set to null or empty, they will get deleted.

Custom Data

  • If customData is not provided or set to null, it will NOT get deleted.
  • If customData is provided, it will be replaced by the provided information.
  • If customData is provided and empty, it will be replaced with the default values defined in the brand [custom data configuration]
ParameterDetails
id

Integer READ-ONLY

The ID of the brand created by SCAYLE.

name

String

Name of the brand.

group

String

Group name allowing to group different brands.

logoUrl

String

URL of the image, either manually specified or generated by SCAYLE, if the SCAYLE CDN is used.

logoSource

AssetSource

A source specifying where to download the logo from.

attributes

Attribute[]

A list of attributes attached to the brand.

customData

CustomData

Arbitrary fields assigned to Brands

Update a Brand Name

let response = await adminApi.apis.Brands.getBrand({brandId: 1});
let brand = response.body;

brand.name = "New Name";

response = await adminApi.apis.Brands.updateBrand({brandId: brand.id}, {requestBody: brand});
let updatedBrand = response.body;

console.log(updatedBrand.name);

Delete a brand

Learn how to delete a brand.

While you cannot delete the default brand attribute group or brand entity created during the initial integration process, you can delete individual brands.

This method is used to delete an existing brands along with all its attributes.

  • Only brands which are not assigned to products can be deleted.
  • This action can not be undone!
adminApi.apis.Brands.deleteBrand({brandId: brandId});

Delete a Brand by ID

await adminApi.apis.Brands.deleteBrand({brandId: 1});

Get a brand

Learn how to retrieve a brand.

When you create a brand, SCAYLE will assign it a unique ID for internal reference. You will need this ID to request a brand.

This method can be used to get an existing brand by using SCAYLE's internal brand ID.

This method allows including nested resources using the with parameter.

Options

ParameterTypeDescription
idintegerThe ID of the brand created by SCAYLE.
namestringName of the brand.
groupstringGroup name allowing to group different brands.
logoUrlstringURL of the image, either manually specified or generated by SCAYLE, if the SCAYLE CDN is used.
logoSourceAssetSourceA source specifying where to download the logo from.
attributesAttribute[]A list of attributes attached to the brand.
customDataCustomDataArbitrary fields assigned to Brands.

Get a Brand by ID

response = await adminApi.apis.Brands.getBrand({brandId: 1});
let brand = response.body;

console.log(brand.name);

Get a Brand with Attributes

response = await adminApi.apis.Brands.getBrand({
  brandId: 1,
  with: 'attributes'
});

let brand = response.body;

brand.attributes.forEach(
  attribute => console.log(attribute.value)
);

Get a collection of brands

Learn how to retrieve a collection of brands.

You can request multiple brands by, e.g., specifying brand names. As search results are paginated, you can set the amount of brands displayed per page.

About this Method

This method can be used to get a collection of existing brands. It is possible to refine the search by applying filters in the options.

This method allows including nested resources using the with parameter.

Method Signature

let response = await adminApi.apis.Brands.getBrands();
let brands = response.body.entities;

Options

ParameterDetails
with

String

Allows to load the following nested resources within this request:

  • attributes
  • customData
limit

Integer

Maximum number of items in the result. (default: 100, maximum: 1000)

filters[minId]

Integer

Minimum number of entities that should be returned with brand IDs.

filters[name]

String

Comma-separated list of brand names that should be used for filtering.

Brand Collection

ParameterDetails
entitiesA collection of brands.
cursorAn object containing information for use in pagination.

Examples

Get a list of 10 Brands

let response = await adminApi.apis.Brands.getBrands({
  limit: 10
});
let brands = response.body.entities;

brands.forEach(
  brand => console.log(brand.name)
);

List Brands filtered by Names

Get a list of brands filtered by names:

let response = await adminApi.apis.Brands.getBrands({
    'filters[name]': 'MyFirstBrand,MySecondBrand'
});
let brands = response.body.entities;

brands.forEach(
    brand => console.log(brand.name)
);

Storefront API

Overview

Each product can be assigned to one or more brands. You can set up and modify brands through the SCAYLE Panel.

With the configured Storefront API client, you can:

  • retrieve a list of available brands
  • get brand by ID

Get a single brand

Use this endpoint when you want to retrieve a single brand information.

Get a brand by ID

ParameterTypeDetails
brandIdIntegerThe brandId of the brand to retrieve.

Examples

Let's say we know that there is a brand with ID 44. We can fetch its properties by doing the following.

// Get a brand by id
$brand = $client->brands->getById(44);
Response
{
    "id": 44,
    "slug": "tom-tailor",
    "name": "Tom Tailor",
    "externalReference": "",
    "group": "",
    "isActive": true,
    "logoHash": "",
    "createdAt": "2023-06-12T14:05:43+00:00",
    "updatedAt": "2023-06-12T14:05:43+00:00",
    "indexedAt": "2023-07-01T09:12:24+00:00",
    "customData": {}
},
{
    "id": 673,
    "slug": "700",
    "name": "700",
    "externalReference": "",
    "group": "",
    "isActive": true,
    "logoHash": "",
    "createdAt": "2021-12-14T10:29:56+00:00",
    "updatedAt": "2021-12-14T10:29:56+00:00",
    "indexedAt": "2023-12-27T14:42:49+00:00",
    "customData": {}
}

Get a collection of brands

With this API you can request a listing of all brands in your shop.

The results are paginated. See Pagination for further details.

Parameters

ParameterTypeDetails
paginationPaginationStateDefines the page to return and how many elements to include per page.

Examples

All examples require a configured Storefront API client being available as client.

See Authentication for how to set up.

Get All Brands

// Get all brands
$brands = $client->brands->get();
var_dump($brands->entities[0]->name)
// string(14) "Tommy Hilfiger"
Response
{
    "pagination": { "current": 4, "total": 4, "perPage": 100, "page": 1, "first": 1, "prev": 1, "next": 1, "last": 1 },
    "entities": [
        {
            "id": 10,
            "slug": "tommy-hilfiger",
            "name": "Tommy Hilfiger",
            "externalReference": "",
            "group": "",
            "isActive": true,
            "logoHash": "",
            "createdAt": "2023-06-12T14:05:34+00:00",
            "updatedAt": "2023-06-12T14:05:34+00:00",
            "indexedAt": "2023-07-01T09:12:24+00:00",
            "customData": {}
        },
        {
            "id": 44,
            "slug": "tom-tailor",
            "name": "Tom Tailor",
            "externalReference": "",
            "group": "",
            "isActive": true,
            "logoHash": "",
            "createdAt": "2023-06-12T14:05:43+00:00",
            "updatedAt": "2023-06-12T14:05:43+00:00",
            "indexedAt": "2023-07-01T09:12:24+00:00",
            "customData": {}
        },
        {
            "id": 52,
            "slug": "lewis",
            "name": "Lewis",
            "externalReference": "",
            "group": "",
            "isActive": true,
            "logoHash": "",
            "createdAt": "2023-06-12T14:05:49+00:00",
            "updatedAt": "2023-06-12T14:05:49+00:00",
            "indexedAt": "2023-07-01T09:12:24+00:00",
            "customData": {}
        },
        {
            "id": 78,
            "slug": "liu-jo",
            "name": "Liu Jo",
            "externalReference": "",
            "group": "",
            "isActive": true,
            "logoHash": "",
            "createdAt": "2023-06-12T14:06:03+00:00",
            "updatedAt": "2023-06-12T14:06:03+00:00",
            "indexedAt": "2023-07-01T09:12:24+00:00",
            "customData": {}
        }
    ]
}

Get a Brand by ID

Let's say we know that there is a brand with ID 44. We can fetch its properties by doing the following.

// Get a brand by id
$brand = $client->brands->getById(44);
Response
{
    "id": 44,
    "slug": "tom-tailor",
    "name": "Tom Tailor",
    "externalReference": "",
    "group": "",
    "isActive": true,
    "logoHash": "",
    "createdAt": "2023-06-12T14:05:43+00:00",
    "updatedAt": "2023-06-12T14:05:43+00:00",
    "indexedAt": "2023-07-01T09:12:24+00:00",
    "customData": {}
},
{
    "id": 673,
    "slug": "700",
    "name": "700",
    "externalReference": "",
    "group": "",
    "isActive": true,
    "logoHash": "",
    "createdAt": "2021-12-14T10:29:56+00:00",
    "updatedAt": "2021-12-14T10:29:56+00:00",
    "indexedAt": "2023-12-27T14:42:49+00:00",
    "customData": {}
}

Get a Brand by Slug

We can retrieve brand information using either a numeric ID or a brand's properties using their respective slugs.

// Get a brand by slug
$brand = $client->brands->getBySlug("700");
Response
{
  "id": 44,
  "slug": "tom-tailor",
  "name": "Tom Tailor",
  "externalReference": "",
  "group": "",
  "isActive": true,
  "logoHash": "",
  "createdAt": "2023-06-12T14:05:43+00:00",
  "updatedAt": "2023-06-12T14:05:43+00:00",
  "indexedAt": "2023-07-01T09:12:24+00:00",
  "customData": {}
},
{
"id": 673,
"slug": "700",
"name": "700",
"externalReference": "",
"group": "",
"isActive": true,
"logoHash": "",
"createdAt": "2021-12-14T10:29:56+00:00",
"updatedAt": "2021-12-14T10:29:56+00:00",
"indexedAt": "2023-12-27T14:42:49+00:00",
"customData": {}
}