getTemplateByMarker
Get a single template by its marker.
Description
Fetches a template by its marker and resolves to an ITemplateEntity. If no template has that marker, it resolves to an IError with statusCode: 404.
.getTemplateByMarker(
,
);
Parameters schema
Schema
marker(required): string
Marker of the template to fetch.
example: "template_12345"
langCode: string
Language code. Default: the langCode passed to defineOneEntry ("en_US" if none).
example: "en_US"
Examples
Minimal example
const response = await Templates.getTemplateByMarker('template');
Example with langCode
const response = await Templates.getTemplateByMarker('template', 'en_US');
Example response
{
"id": 4,
"attributeSetIdentifier": null,
"title": "Template",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 1
}
Response schema
Schema: ITemplateEntity
id: number
ID of the object.
example: 12345
attributeSetIdentifier: string | null
Marker of the attribute set, or null if none is assigned.
example: "attribute_set_1"
title: string
Name of the template.
example: "Product Template"
generalTypeId: number
ID of the general type.
example: 67890
identifier: string
Text identifier (marker) of the object.
example: "template_12345"
version: number
Version number of the object; changes with each update.
example: 1
generalTypeName: BlockType
General type name.
example: "product"
attributeValues: IAttributeValues
Attribute values keyed by marker; an empty object when there are none.
example:
{
"color": {
"type": "string",
"value": "red",
"isIcon": false,
"position": 0,
"additionalFields": {}
}
}
position: number
Position of the object, used for sorting.
example: 1