Skip to main content

getAllTemplates

Getting all template objects of a specific type

Templates.getAllTemplates(langCode)

const value = await Templates.getAllTemplates()
Schema

langCode: string
Optional parameter language code
example: en_US

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.

Example return:

{
"forTextBlock": [
{
"id": 1,
"version": 0,
"identifier": "for-block",
"title": "For blocks",
"generalTypeName": "forTextBlock",
"generalTypeId": 18,
"position": 1,
"attributeValues": {
"en_US": {
"marker": {
"value": "",
"type": "string",
"position": 1,
"isProductPreview": false,
"isIcon": false,
"attributeFields": {
"marker": {
"type": "string",
"value": "test"
}
}
}
}
},
"attributeIdentifier": "my-set"
}
]
}
Schema

id: number
object identifier
example: 1764

version number
object's version number of modification
example: 10

identifier: string
textual identifier for a field in the record
example: catalog

generalTypeId: number
type identifier
example: 4

title: string
template name
example: page template

position object
position number
example: 0

generalTypeName string
example: forProductPreview
general type name