Skip to main content

getAttributes

Getting all attribute set objects. This method return all attribute sets objects and total. It returns a Promise that resolves to an IAttributesSetsResponse object.

Description

  • In addition to returning the list of attribute set objects, the method also provides the total count of these objects. This is particularly useful for pagination, reporting, and analytics purposes, allowing developers and administrators to understand the scope and scale of the attribute sets being managed.

  • This functionality is essential for applications where dynamic data modeling is required. For instance, e-commerce platforms might use attribute sets to define different product categories, each with its own unique set of attributes like size, color, material, etc. It can also be used in user management systems where different user roles have distinct attribute requirements.

  • The method is likely designed to integrate seamlessly with other components of the system, allowing for flexible data manipulation and presentation. This could involve filtering, sorting, or transforming the attribute sets based on specific criteria or business logic.

AttributesSets.getAttributes(

langCode, offset, limit, typeId, sortBy

);

Parameters schema

Schema

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

offset: number
parameter offset of record selection. Default: 0
example: 0

limit: number
parameter limiting the selection of records. Default: 30
example: 30

typeId: number
identifier of the attribute set type. Default: null
example: NaN

sortBy: string
identifier of the attribute set type. Default: "id"
example: "id"

Examples

Minimal example

const response = await AttributesSets.getAttributes();

Example with attributes

const response = await AttributesSets.getAttributes('en_US', 0, 30, null, 'id');

Example response

{
"total": 16,
"items": [
{
"id": 27,
"updatedDate": "2025-02-26T17:18:11.275Z",
"version": 0,
"identifier": "admins",
"typeId": 1,
"title": "Admins",
"schema": {
"admin-text": {
"id": 1,
"type": "string",
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "admin-text",
"localizeInfos": {
"title": "Admins text"
}
}
},
"isVisible": true,
"properties": {},
"type": {
"id": 1,
"type": "forAdmins"
},
"position": 1
},
{
"id": 22,
"updatedDate": "2025-03-23T12:23:56.420Z",
"version": 0,
"identifier": "block",
"typeId": 2,
"title": "Block",
"schema": {
"block-text": {
"id": 1,
"type": "string",
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "block-text",
"localizeInfos": {
"title": "Block text"
}
},
"interval": {
"id": 2,
"type": "timeInterval",
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "interval",
"localizeInfos": {
"title": "Interval",
"intervals": [
{
"id": "c6466cd8-c55d-4583-97c5-42b684210f12",
"range": [],
"external": [],
"fullMonth": 2,
"intervals": [
{
"id": "ab0e3e90-8153-4679-aea4-198c5022f8d4",
"end": {
"hours": 19,
"minutes": 0
},
"start": {
"hours": 9,
"minutes": 0
},
"period": 60
}
],
"inEveryMonth": true,
"selectedYear": 2025
}
]
}
}
},
"isVisible": true,
"properties": {},
"type": {
"id": 2,
"type": "forBlocks"
},
"position": 2
},
{
"id": 17,
"updatedDate": "2025-02-26T16:25:01.688Z",
"version": 0,
"identifier": "page",
"typeId": 4,
"title": "Page",
"schema": {
"text": {
"id": 1,
"type": "string",
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "text",
"localizeInfos": {
"title": "text"
}
},
"number": {
"id": 2,
"type": "integer",
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "number",
"localizeInfos": {
"title": "Number"
}
},
"real": {
"id": 3,
"type": "real",
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "real",
"localizeInfos": {
"title": "Real"
}
},
"float": {
"id": 4,
"type": "float",
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "float",
"localizeInfos": {
"title": "Float"
}
}
},
"isVisible": true,
"properties": {},
"type": {
"id": 4,
"type": "forPages"
},
"position": 3
},
"..."
]
}

Response schema

Schema: IAttributesSetsResponse

total: number
Total items.
example: 100

items: IAttributeSetsEntity[]
IAttributeSetsEntity array containing attribute set entities.
example:

[
{
"id": 1,
"identifier": "set1"
},
{
"id": 2,
"identifier": "set2"
}
]