getAttributes
Mengambil semua objek set atribut. Metode ini mengembalikan semua objek set atribut dan totalnya. Ini mengembalikan Promise yang menyelesaikan menjadi objek IAttributesSetsResponse.
Deskripsiβ
-
Selain mengembalikan daftar objek set atribut, metode ini juga menyediakan total jumlah objek tersebut. Ini sangat berguna untuk tujuan paginasi, pelaporan, dan analitik, memungkinkan pengembang dan administrator untuk memahami ruang lingkup dan skala set atribut yang dikelola.
-
Fungsionalitas ini sangat penting untuk aplikasi di mana pemodelan data dinamis diperlukan. Misalnya, platform e-commerce mungkin menggunakan set atribut untuk mendefinisikan kategori produk yang berbeda, masing-masing dengan set atribut uniknya sendiri seperti ukuran, warna, bahan, dll. Ini juga dapat digunakan dalam sistem manajemen pengguna di mana peran pengguna yang berbeda memiliki persyaratan atribut yang berbeda.
-
Metode ini kemungkinan dirancang untuk terintegrasi dengan mulus dengan komponen lain dari sistem, memungkinkan manipulasi dan presentasi data yang fleksibel. Ini bisa melibatkan penyaringan, pengurutan, atau transformasi set atribut berdasarkan kriteria atau logika bisnis tertentu.
π‘Data yang dikembalikan dalam set atribut tidak termasuk nilai atribut yang sebenarnya, karena nilai-nilai ini terkandung dalam entitas tertentu seperti halaman, produk, dll. Satu-satunya pengecualian adalah tipe atribut timeInterval. Atribut ini dapat memiliki nilai dengan mencentang kotak yang sesuai di panel admin.
AttributesSets.getAttributes(
langCode,
offset,
limit,
typeId,
sortBy
);
Skema parameterβ
Skema
langCode: string
Kode bahasa. Default: "en_US"
contoh: "en_US"
offset: number
parameter offset dari pemilihan catatan. Default: 0
contoh: 0
limit: number
parameter yang membatasi pemilihan catatan. Default: 30
contoh: 30
typeId: number
identifikasi tipe set atribut. Default: null
contoh: NaN
sortBy: string
identifikasi tipe set atribut. Default: "id"
contoh: "id"
Secara default, Anda dapat mengambil 10 objek. Ini disebabkan oleh batasan catatan dalam pengaturan izin modul.
Agar paginasi berfungsi dengan benar, Anda perlu mengonfigurasi Izin Modul sesuai kebutuhan Anda di bagian yang sesuai.
Contohβ
Contoh minimalβ
const response = await AttributesSets.getAttributes();
Contoh dengan atributβ
const response = await AttributesSets.getAttributes('en_US', 0, 30, null, 'id');
Contoh responsβ
{
"total": 21,
"items": [
{
"id": 38,
"createdDate": "2026-06-09T06:06:13.667Z",
"updatedDate": "2026-06-09T06:12:00.790Z",
"version": 0,
"identifier": "subscription",
"title": "Subscription",
"schema": {
"price": {
"id": 2,
"type": "integer",
"isPrice": true,
"original": true,
"isVisible": true,
"splitUnit": "percent",
"identifier": "price",
"isCurrency": false,
"splitPrice": false,
"initialValue": null,
"localizeInfos": {
"title": "price"
},
"value": null
},
"currency_products": {
"id": 4,
"type": "string",
"isPrice": false,
"original": true,
"isVisible": true,
"splitUnit": false,
"identifier": "currency_products",
"isCurrency": true,
"splitPrice": false,
"validators": {
"defaultValueValidator": {
"customErrorText": "Custom error",
"fieldDefaultValue": "usd",
"fieldDefaultValue2": ""
}
},
"initialValue": null,
"localizeInfos": {
"title": "Currency"
}
}
},
"isVisible": true,
"type": {
"id": 5,
"type": "forProducts"
},
"position": 1
},
{
"id": 33,
"createdDate": "2026-04-22T16:28:05.346Z",
"updatedDate": "2026-04-23T10:57:26.245Z",
"version": 1,
"identifier": "percent_split",
"title": "Percent split",
"schema": {
"s0": {
"id": 1,
"type": "float",
"isPrice": true,
"original": true,
"isVisible": true,
"splitUnit": "percent",
"identifier": "s0",
"splitParts": [
2,
3
],
"splitPrice": true,
"localizeInfos": {
"title": "s0"
},
"value": null
},
"s1": {
"id": 2,
"type": "float",
"isPrice": false,
"original": true,
"isVisible": true,
"splitUnit": false,
"identifier": "s1",
"splitParts": false,
"splitPrice": false,
"localizeInfos": {
"title": "s1"
},
"value": null
},
"s2": {
"id": 3,
"type": "float",
"isPrice": false,
"original": true,
"isVisible": true,
"splitUnit": false,
"identifier": "s2",
"splitParts": false,
"localizeInfos": {
"title": "s2"
},
"value": null
},
"currency": {
"id": 4,
"type": "string",
"isPrice": false,
"original": true,
"isVisible": true,
"splitUnit": false,
"identifier": "currency",
"isCurrency": true,
"validators": {
"defaultValueValidator": {
"fieldDefaultValue": "usd",
"fieldDefaultValue2": ""
}
},
"localizeInfos": {
"title": "currency"
}
}
},
"isVisible": true,
"type": {
"id": 5,
"type": "forProducts"
},
"position": 2
},
{
"id": 31,
"createdDate": "2026-03-14T14:53:28.721Z",
"updatedDate": "2026-03-14T14:53:52.760Z",
"version": 0,
"identifier": "discounts",
"title": "Discounts",
"schema": {
"example_discount": {
"id": 1,
"type": "string",
"original": true,
"isVisible": true,
"identifier": "example_discount",
"localizeInfos": {
"title": "example_discount"
}
}
},
"isVisible": true,
"type": {
"id": 11,
"type": "forDiscounts"
},
"position": 3
},
"..."
]
}
Skema responsβ
Skema: IAttributesSetsResponse
total: number
Total item.
contoh: 100
items: IAttributeSetsEntity[]
Array IAttributeSetsEntity yang berisi entitas set atribut.
contoh:
[
{
"id": 1,
"identifier": "set1"
},
{
"id": 2,
"identifier": "set2"
}
]
items.id: number
Pengidentifikasi unik dari entitas set atribut.
contoh: 123
items.createdDate: string
Tanggal ketika set atribut dibuat.
contoh: "2023-10-01T12:00:00Z"
items.updatedDate: string
Tanggal ketika set atribut terakhir diperbarui.
contoh: "2023-10-01T12:00:00Z"
items.version: number
Nomor versi dari set atribut, digunakan untuk melacak perubahan atau pembaruan.
contoh: 1
items.identifier: string
Sebuah string yang secara unik mengidentifikasi set atribut.
contoh: "attributeSet1"
items.title: string
Judul atau nama dari set atribut.
contoh: "Atribut Produk"
items.schema: Record<string, IAttributeSchemaItem>
Bidang skema yang dikunci berdasarkan penanda.
contoh:
{
"attribute1": {
"id": 1,
"type": "string",
"isPrice": false,
"original": true,
"identifier": "string",
"localizeInfos": {
"en_US": {
"title": "String"
}
}
}
}
items.isVisible: boolean
Menunjukkan apakah set atribut terlihat atau tidak.
contoh: true
items.type: string
Tipe dari set atribut, yang bisa berupa klasifikasi atau kategori tertentu.
contoh: "produk", "pengguna", "dll"
items.position: number
Nomor posisi untuk mengurutkan set atribut.
contoh: 1