getRootPages
Get all top-level pages (parentId = null).
Description
Fetches the top-level pages and resolves to an array of IPagesEntity objects, or [] when there are none.
.getRootPages(
);
Parameters schema
Schema
langCode: string
Language code. Default: the langCode passed to defineOneEntry ("en_US" if none).
example: "en_US"
Examples
Minimal example
const response = await Pages.getRootPages();
Example with langCode
const response = await Pages.getRootPages('en_US');
Example response
[
{
"id": 8,
"config": {},
"depth": 0,
"parentId": null,
"pageUrl": "blog",
"attributeSetIdentifier": "page",
"localizeInfos": {
"title": "Blog",
"htmlContent": "",
"plainContent": "",
"menuTitle": "Blog"
},
"isVisible": true,
"products": 0,
"childrenCount": 2,
"type": "common_page",
"position": 3,
"templateIdentifier": "template",
"isSync": true,
"categoryPath": "blog",
"rating": {},
"attributeValues": {
"text": {
"type": "string",
"value": "some text",
"isIcon": false,
"position": 0,
"additionalFields": {},
"isProductPreview": false
},
"number": {
"type": "integer",
"value": 5,
"isIcon": false,
"position": 1,
"additionalFields": {},
"isProductPreview": false
},
"real": {
"type": "real",
"value": 10,
"isIcon": false,
"position": 2,
"additionalFields": {},
"isProductPreview": false
},
"float": {
"type": "float",
"value": 12,
"isIcon": false,
"position": 3,
"additionalFields": {},
"isProductPreview": false
}
},
"moduleFormConfigs": [
{
"id": 9,
"formIdentifier": "full_form",
"moduleIdentifier": "content",
"isGlobal": false,
"isClosed": false,
"isModerate": true,
"viewOnlyMyData": false,
"commentOnlyMyData": false,
"entityIdentifiers": [
{
"id": "blog",
"isNested": false
}
],
"formDataCount": 6281,
"ratingCalculation": "average",
"allowHalfRatings": null,
"maxRatingScale": null,
"isAnonymous": null,
"allowRerating": null,
"isRating": null,
"entityFormDataCount": {
"blog": 6281
},
"nestedEntityIdentifiers": [],
"exceptionIds": []
},
{
"id": 3,
"formIdentifier": "file_form",
"moduleIdentifier": "content",
"isGlobal": false,
"isClosed": false,
"isModerate": false,
"viewOnlyMyData": false,
"commentOnlyMyData": false,
"entityIdentifiers": [
{
"id": "blog",
"isNested": false
}
],
"formDataCount": 691,
"ratingCalculation": "average",
"allowHalfRatings": null,
"maxRatingScale": null,
"isAnonymous": null,
"allowRerating": null,
"isRating": null,
"entityFormDataCount": {
"blog": 691
},
"nestedEntityIdentifiers": [],
"exceptionIds": []
},
{
"id": 2,
"formIdentifier": "test-form",
"moduleIdentifier": "content",
"isGlobal": false,
"isClosed": false,
"isModerate": false,
"viewOnlyMyData": false,
"commentOnlyMyData": false,
"entityIdentifiers": [
{
"id": "blog",
"isNested": false
}
],
"formDataCount": 909,
"ratingCalculation": "average",
"allowHalfRatings": null,
"maxRatingScale": null,
"isAnonymous": null,
"allowRerating": null,
"isRating": null,
"entityFormDataCount": {
"blog": 909
},
"nestedEntityIdentifiers": [],
"exceptionIds": []
}
],
"template": {
"id": 4,
"attributeSetIdentifier": null,
"title": "Template",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 1
}
},
{
"id": 10,
"config": {},
"depth": 0,
"parentId": null,
"pageUrl": "catalog",
"attributeSetIdentifier": "page",
"localizeInfos": {
"title": "Catalog",
"htmlContent": "",
"plainContent": "",
"menuTitle": "Catalog"
},
"isVisible": true,
"products": 6,
"childrenCount": 0,
"type": "catalog_page",
"position": 2,
"templateIdentifier": "template",
"isSync": true,
"categoryPath": "catalog",
"rating": {},
"attributeValues": {
"text": {
"type": "string",
"value": "catalog text",
"isIcon": false,
"position": 0,
"additionalFields": {},
"isProductPreview": false
},
"number": {
"type": "integer",
"value": 10,
"isIcon": false,
"position": 1,
"additionalFields": {},
"isProductPreview": false
},
"real": {
"type": "real",
"value": 5,
"isIcon": false,
"position": 2,
"additionalFields": {},
"isProductPreview": false
},
"float": {
"type": "float",
"value": 15,
"isIcon": false,
"position": 3,
"additionalFields": {},
"isProductPreview": false
}
},
"moduleFormConfigs": [],
"template": {
"id": 4,
"attributeSetIdentifier": null,
"title": "Template",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 1
}
},
{
"id": 50,
"config": {},
"depth": 0,
"parentId": null,
"pageUrl": "test",
"attributeSetIdentifier": null,
"localizeInfos": {
"title": "Test",
"htmlContent": "",
"plainContent": "",
"menuTitle": "Test"
},
"isVisible": true,
"products": 0,
"childrenCount": 0,
"type": "common_page",
"position": 1,
"templateIdentifier": null,
"isSync": false,
"categoryPath": "test",
"rating": {},
"attributeValues": {},
"moduleFormConfigs": []
}
]
Response schema
Schema: IPagesEntity[]
id: number
Object ID.
example: 8
parentId: number | null
ID of the parent page; null for a top-level page.
example: 10
pageUrl: string
URL of the page.
example: "blog"
depth: number
Nesting level of the page: 0 for a top-level page, 1 for its children, and so on.
example: 10
localizeInfos: ILocalizeInfo
Localized page content: title, menuTitle, htmlContent and plainContent.
example:
{
"title": "Blog",
"menuTitle": "Blog",
"htmlContent": "",
"plainContent": ""
}
isVisible: boolean
Whether the page is visible.
example: true
type: PageType
Page type.
example: "common_page"
templateIdentifier: string | null
Marker of the linked template.
example: "template"
attributeSetIdentifier: string | null
Marker of the attribute set, or null if none is assigned.
example: "page"
attributeValues: IAttributeValues
Attribute values keyed by marker; an empty object when there are none.
example:
{
"text": {
"type": "string",
"value": "some text",
"position": 0,
"additionalFields": {}
}
}
isSync: boolean
Whether the page's attribute index is up to date for the requested language.
example: true
template: object
Template linked to the page.
example:
{}
position: number
Position used for sorting.
example: 2
config: Record<string, number>
Output settings for catalog pages.
example:
{
"rowsPerPage": 1,
"productsPerRow": 1
}
products: number
Number of products linked to the page.
example: 0
childrenCount: number
Number of child pages.
example: 1
blocks: IBlockEntity[] | string[]
Blocks attached to the page: block objects or their markers.
example:
[
"product_block"
]
blocks.attributeValues: IAttributeValues
Attribute values keyed by marker; an empty object when there are none.
example:
{
"block-text": {
"type": "string",
"value": "some text",
"isIcon": false,
"position": 0,
"additionalFields": {},
"isProductPreview": false
}
}
blocks.id: number
ID of the block.
example: 1234
blocks.localizeInfos: ILocalizeInfo
Localized data of the block.
example:
{
"title": "Example title"
}
blocks.version: number
Version number of the block.
example: 1
blocks.identifier: string
Marker of the block.
example: "block1"
blocks.type: BlockType
Type of the block.
example: "product_block"
blocks.position: number
Position of the block, used for sorting.
example: 1
blocks.templateIdentifier: string | null
Marker of the template used by the block, or null.
example: "template1"
blocks.isVisible: boolean
Whether the block is visible.
example: true
blocks.countElementsPerRow: number
Number of items per row in the block, if set.
example: 3
blocks.quantity: number
Quantity of items in the block, if applicable.
example: 5
blocks.similarProducts: IProductsResponse
Similar products for the block, as total and items.
example:
{
"total": 10,
"items": []
}
blocks.products: IProductsEntity[]
Products linked to the block.
example:
[
{
"id": 1,
"localizeInfos": {
"title": "Product 1"
}
},
{
"id": 2,
"localizeInfos": {
"title": "Product 2"
}
}
]
nestedBlocks: IBlockEntity[] | string[]
Blocks attached to the page's nested entities (catalog product preview, etc.): block objects or their markers. Returned by the semantic (vector) search / indexed page responses, as a list of markers.
example:
[
"product_block",
"similar"
]
moduleFormConfigs: Array<IFormConfig>
Form configurations of the module linked to the page.
rating: IRating
Rating data: average value, likes and dislikes, and the calculation method.
categoryPath: string | null
Category path; null for nested pages that have no category path of their own.
example: "catalog"
distance: number
Cosine distance to the query. Returned on every item by the semantic (vector) search endpoint.
example: 0.12
Usage examples
Step-by-step walkthrough in the documentation:
- Get root pages: retrieve all top-level pages without a parent.
Try it live
Run this method in the JS SDK sandbox. On your first visit, connect your Project URL and App Token, then open:
- Get root pages: retrieve all top-level pages without a parent.