Skip to main content

getAllTemplates

Getting all template objects of a specific type.

Description

This method retrieves all template objects grouped by types from the API. It returns a Promise that resolves to an object GroupedTemplatesObject, which contains an array of template objects.

Templates.getAllTemplates(

langCode

);

Parameters schema

Schema

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

Examples

Minimal example

const response = await Templates.getAllTemplates();

Example with attributes

const response = await Templates.getAllTemplates('en_US');

Example response

{
"frequently_ordered_block": [
{
"id": 7,
"attributeSetIdentifier": null,
"title": "Default frequently ordered block template",
"generalTypeId": 24,
"identifier": "frequently_ordered_block_default",
"version": 0,
"generalTypeName": "frequently_ordered_block",
"attributeValues": {},
"position": 12
}
],
"recently_viewed_block": [
{
"id": 10,
"attributeSetIdentifier": null,
"title": "Default recently viewed block template",
"generalTypeId": 27,
"identifier": "recently_viewed_block_default",
"version": 0,
"generalTypeName": "recently_viewed_block",
"attributeValues": {},
"position": 9
}
],
"trending_block": [
{
"id": 9,
"attributeSetIdentifier": null,
"title": "Default trending block template",
"generalTypeId": 26,
"identifier": "trending_block_default",
"version": 0,
"generalTypeName": "trending_block",
"attributeValues": {},
"position": 10
}
],
"slider_block": [
{
"id": 8,
"attributeSetIdentifier": null,
"title": "Default slider block template",
"generalTypeId": 25,
"identifier": "slider_block_default",
"version": 0,
"generalTypeName": "slider_block",
"attributeValues": {},
"position": 11
}
],
"wishlist_similar_block": [
{
"id": 15,
"attributeSetIdentifier": null,
"title": "Default wishlist similar block template",
"generalTypeId": 32,
"identifier": "wishlist_similar_block_default",
"version": 0,
"generalTypeName": "wishlist_similar_block",
"attributeValues": {},
"position": 4
}
],
"cart_similar_block": [
{
"id": 14,
"attributeSetIdentifier": null,
"title": "Default cart similar block template",
"generalTypeId": 31,
"identifier": "cart_similar_block_default",
"version": 0,
"generalTypeName": "cart_similar_block",
"attributeValues": {},
"position": 5
}
],
"cart_complement_block": [
{
"id": 13,
"attributeSetIdentifier": null,
"title": "Default cart complement block template",
"generalTypeId": 30,
"identifier": "cart_complement_block_default",
"version": 0,
"generalTypeName": "cart_complement_block",
"attributeValues": {},
"position": 6
}
],
"personal_recommendations_block": [
{
"id": 12,
"attributeSetIdentifier": null,
"title": "Default personal recommendations block template",
"generalTypeId": 29,
"identifier": "personal_recommendations_block_default",
"version": 0,
"generalTypeName": "personal_recommendations_block",
"attributeValues": {},
"position": 7
}
],
"repeat_purchase_block": [
{
"id": 11,
"attributeSetIdentifier": null,
"title": "Default repeat purchase block template",
"generalTypeId": 28,
"identifier": "repeat_purchase_block_default",
"version": 0,
"generalTypeName": "repeat_purchase_block",
"attributeValues": {},
"position": 8
}
],
"catalog_page": [
{
"id": 4,
"attributeSetIdentifier": null,
"title": "Template",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 1
}
]
}

Response schema

Schema: Record<Types, ITemplateEntity[]>

id: number
The unique identifier of the position.
example: 12345

attributeSetIdentifier: string | null
Set of attributes id.
example: "attribute_set_1"

title: string
The name of the template.
example: "Product Template"

generalTypeId: number
General type Entity id.
example: 67890

identifier: string
The textual identifier for the record field.
example: "template_12345"

version: number
The version number of the object.
example: 1

generalTypeName: BlockType
General type name.
example: "product"

attributeValues: IAttributeValues
Map of attribute values keyed by marker; empty object when none.
example:

{
"id": 1,
"value": "some"
}

position: number
The position of the object.
example: 1