Skip to main content

getTemplateById

Get one template object by id.

Templates.getTemplateById(id, langCode)

const value = await Templates.getTemplateById(1)
Schema

id:* number
Template id
example: 1

langCode: string
Optional parameter language code
example: en_US

This method retrieves a single template object based on its identifier (id) from the API. It returns a Promise that resolves to a template object.

Example return:

{
"id": 1764,
"generalTypeId": 4,
"generalTypeName": "forProductPreview",
"title": "Page template",
"identifier": "marker",
"position": 1,
"version": 10,
"attributeValues": {
"marker": {
"value": "",
"type": "string",
"position": 1,
"isProductPreview": false,
"isIcon": false,
"attributeFields": {
"marker": {
"type": "string",
"value": "test"
}
}
}
},
"attributeSetIdentifier": "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