Lewati ke konten utama

getTemplatePreviewByMarker

Mengambil satu objek template berdasarkan marker.

Deskripsi

Metode ini mengambil satu objek template berdasarkan pengidentifikasi tekstualnya (marker) dari API. Ini mengembalikan sebuah Promise yang menyelesaikan menjadi objek pratinjau template ITemplatePreviewsEntity.

TemplatePreviews.getTemplatePreviewByMarker(

marker*, langCode

);

Skema parameter

Skema

marker(diperlukan): string
Marker produk unik yang digunakan untuk mengidentifikasi template. Jika tidak disediakan, perilaku default atau kesalahan mungkin terjadi
contoh: "template_12345"

langCode: string
Kode bahasa. Default: "en_US"
contoh: "en_US"

Contoh

Contoh minimal

const response = await TemplatePreviews.getTemplatePreviewByMarker('my-marker');

Contoh dengan atribut

const response = await TemplatePreviews.getTemplatePreviewByMarker('my-marker', 'en_US');

Contoh respons

{
"id": 3,
"title": "Preview Templates",
"proportions": {
"default": {
"horizontal": {
"width": 234,
"height": 324,
"alignmentType": "middleBottom"
},
"vertical": {
"width": 2,
"height": 3,
"alignmentType": "leftTop"
},
"square": {
"side": 360,
"alignmentType": "middleMiddle"
},
"default": true
}
},
"identifier": "preview-templates",
"version": 1,
"attributeValues": {},
"position": 1,
"isUsed": true
}

Skema respons

Skema: ITemplatePreviewsEntity

id: number
Pengidentifikasi unik dari posisi.
contoh: 3

title: string
Nama dari pratinjau template.
contoh: "Template Produk"

proportions: object
Objek yang berisi info tentang proporsi pratinjau template.
contoh:

{
"default": {
"horizontal": {
"width": 234,
"height": 324,
"alignmentType": "middleBottom"
},
"vertical": {
"width": 2,
"height": 3,
"alignmentType": "leftTop"
},
"square": {
"side": 3,
"alignmentType": "leftTop"
}
}
}

proportions.horizontal: IProportion | null
Proporsi horizontal dari pratinjau template.
contoh:

{
"width": 234,
"height": 324,
"alignmentType": "middleBottom"
}

proportions.horizontal.width: string | number | null
lebar pratinjau template.
contoh: 100

proportions.horizontal.height: string | number | null
tinggi pratinjau template.
contoh: 200

proportions.horizontal.alignmentType: string
tipe perataan dari pratinjau template.
contoh: "center"

proportions.vertical: IProportion | null
Proporsi vertikal dari pratinjau template.
contoh:

{
"width": 2,
"height": 3,
"alignmentType": "leftTop"
}

proportions.square: ISquare
Proporsi persegi dari pratinjau template.
contoh:

{
"side": 3,
"alignmentType": "leftTop"
}

proportions.square.side: number | string
Panjang sisi dari pratinjau template persegi, bisa berupa angka atau string.
contoh: 100

proportions.square.alignmentType: string
tipe perataan dari pratinjau template persegi.
contoh: "center"

identifier: string
Pengidentifikasi tekstual untuk field record.
contoh: "preview-templates"

version: number
Nomor versi dari objek.
contoh: 1

attributeValues: IAttributeValues
Nilai atribut dari indeks.
contoh:

{}

position: number
Posisi dari objek.
contoh: 1

isUsed: boolean
Menunjukkan apakah pratinjau template digunakan.
contoh: true

attributeSetIdentifier: string | null
Pengidentifikasi teks yang digunakan untuk sekumpulan atribut.
contoh: "attribute_set_1"