Skip to main content

getAttributesByMarker

Getting all attributes with data from the attribute set.

Description

This method return all attributes with data from the attribute set. It returns a Promise that resolves to an array of IAttributesSetsEntity objects - the attribute entities themselves (marker, type, value, listTitles, validators, localizeInfos, additionalFields, …), not the attribute set entity.

AttributesSets.getAttributesByMarker(

marker*, langCode

);

Parameters schema

Schema

marker(required): string
Attribute marker
example: "productAttributes"

langCode: string
Language code. Default: "en_US"
example: "en_US"

Examples

Minimal example

const response = await AttributesSets.getAttributesByMarker('my-marker');

Example with attributes

const response = await AttributesSets.getAttributesByMarker('my-marker', 'en_US');

Example response

[
{
"type": "string",
"value": null,
"marker": "admin-text",
"position": 1,
"listTitles": [],
"validators": {},
"initialValue": null,
"localizeInfos": {
"title": "Admins text"
},
"additionalFields": {}
}
]

Response schema

Schema: IAttributesSetsEntity[]

type: AttributeType
Attribute type.
example: "string", "text", "integer", "etc"

value: unknown
Value of the attribute, normalized the same way as an entity attribute value: number | null for numeric types, the file object itself for a single-file image/file, null when the attribute carries no value.

initialValue: unknown
Initial value of the attribute.

marker: string
Textual identifier of the attribute (marker).
example: "color", "size", "etc"

position: number
Position number for sorting.
example: 1

listTitles: IListTitle[]
Array of values (with extended data) for list and radioButton attributes; empty array for non-list types.
example:

[
{
"title": "red",
"value": 1,
"position": 1,
"extendedValue": null,
"extendedValueType": null
},
{
"title": "yellow",
"value": 2,
"position": 2,
"extendedValue": null,
"extendedValueType": null
}
]

listTitles.title: string
The title or name associated with the list item.
example: "Item Name"

listTitles.value: number | string
The value of the list item, which can be either a number or a string depending on the context.
example: 42

listTitles.position: string | number | null
The position of the list item, which can be represented as a string, number, or null if not applicable.
example: 1

listTitles.extended: object
An object containing additional properties or metadata related to the list item. This could include any extra details that extend the basic information.

listTitles.extended.value: string | null
The extended value, which can be a string or null.
example: "extra_value"

listTitles.extended.type: string | null
The type of the extended value, which can be a string or null.
example: "color"

validators: IAttributeValidators
Set of validators for validation; empty object when no validators are configured.
example:

{
"requiredValidator": {
"strict": true
},
"defaultValueValidator": {
"fieldDefaultValue": 11
}
}

validators.requiredValidator: object
Marks the field as required. Shape: { strict: boolean }.
example:

{ strict: true }

validators.stringInspectionValidator: object
Length constraints for string fields. Shape: { stringMin: number; stringMax: number; stringLength: number }.

validators.emailInspectionValidator: boolean
Toggle for email-format validation.

validators.defaultValueValidator: object
Default value configuration with optional custom error text. Shape: { customErrorText?: string; fieldDefaultValue?: unknown; fieldDefaultValue2?: unknown }.

localizeInfos: IAttributeLocalizeInfo
The name of the template, taking into account localization.
example:

{
"title": "My attribute"
}

additionalFields: Record<string, IAttributesSetsEntity>
Nested sub-attributes keyed by marker; empty object when none.


Usage examples

Step-by-step walkthrough in the documentation:

Try it live

Run this method interactively in the JS SDK sandbox — connect your Project URL and App Token on first visit, then open: