Skip to main content

getPageById

Getting a single page object with information about forms, blocks, menus attached to the page.

Description

This method retrieves a single page object based on its identifier (id) from the API. It returns a Promise that resolves to the page object IPagesEntity, with the specific object depending on the type of page being returned.

Pages.getPageById(

id*, langCode

);

Parameters schema

Schema

id(required): number
The unique identifier of the page to be fetched
example: 1

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

Examples

Minimal example

const response = await Pages.getPageById(1);

Example with attributes

const response = await Pages.getPageById(1, 'en_US');

Example response

{
"id": 8,
"parentId": null,
"pageUrl": "blog",
"depth": 0,
"localizeInfos": {
"title": "Blog",
"menuTitle": "Blog",
"htmlContent": "",
"plainContent": ""
},
"isVisible": true,
"blocks": [
"slider"
],
"type": "common_page",
"templateIdentifier": "template",
"attributeSetIdentifier": "page",
"attributeValues": {
"text": {
"type": "string",
"value": "some text",
"position": 0,
"additionalFields": {}
},
"number": {
"type": "integer",
"value": 0,
"position": 1,
"additionalFields": {}
},
"real": {
"type": "real",
"value": "",
"position": 2,
"additionalFields": {}
},
"float": {
"type": "float",
"value": 0,
"position": 3,
"additionalFields": {}
}
},
"moduleFormConfigs": [
{
"id": 9,
"formIdentifier": "full_form",
"moduleIdentifier": "content",
"isGlobal": false,
"isClosed": false,
"isModerate": true,
"viewOnlyMyData": false,
"commentOnlyMyData": false,
"entityIdentifiers": [
{
"id": "blog",
"isNested": false
}
],
"formDataCount": 4827,
"ratingCalculation": "average",
"allowHalfRatings": null,
"maxRatingScale": null,
"isAnonymous": null,
"allowRerating": null,
"isRating": null,
"entityFormDataCount": {
"blog": 4827
},
"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": 556,
"ratingCalculation": "average",
"allowHalfRatings": null,
"maxRatingScale": null,
"isAnonymous": null,
"allowRerating": null,
"isRating": null,
"entityFormDataCount": {
"blog": 556
},
"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": 775,
"ratingCalculation": "average",
"allowHalfRatings": null,
"maxRatingScale": null,
"isAnonymous": null,
"allowRerating": null,
"isRating": null,
"entityFormDataCount": {
"blog": 775
},
"nestedEntityIdentifiers": [],
"exceptionIds": []
}
],
"isSync": true,
"template": {
"id": 4,
"attributeSetIdentifier": null,
"title": "Template",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 1
}
}

Response schema

Schema: IPagesEntity

id: number
The identifier of the object.
example: 8

parentId: number | null
The id of the parent page, if it contains null, then it is the top-level page.
example: 10

pageUrl: string
Unique page Url.
example: "blog"

depth: number
Page nesting depth relative to parentId.
example: 10

localizeInfos: ILocalizeInfo
The name of the page, taking into account localization.
example:

{
"title": "Blog",
"menuTitle": "Blog",
"htmlContent": "",
"plainContent": ""
}

isVisible: boolean
A sign of page visibility.
example: true

type: PageType
Page type.
example: "common_page"

templateIdentifier: string | null
User id of the linked template.
example: "template"

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

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

{
"text": {
"type": "string",
"value": "some text",
"position": 0,
"additionalFields": []
}
}

isSync: boolean
Indication of page indexing.
example: true

template: object
Template object.
example:

{}

position: number
Item number (for sorting).
example: 2

config: Record<string, number>
Output settings for catalog pages.
example:

{
"rowsPerPage": 1,
"productsPerRow": 1
}

products: number
The number of products linked to the page.
example: 0

childrenCount: number
Children count.
example: 1

blocks: IBlockEntity[] | string[]
blocks.
example:

{
"id": 4,
"attributeSetIdentifier": null,
"title": "Template",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 1
}

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

{
"block-text": {
"type": "string",
"value": "some text",
"isIcon": false,
"position": 0,
"additionalFields": [],
"isProductPreview": false
}
}

blocks.id: number
Unique identifier of the block.
example: 1234

blocks.localizeInfos: ILocalizeInfo
Localization information for the block.
example:

{
"key": "value"
}

blocks.version: number
Version of the block entity.
example: 1

blocks.identifier: string
Unique string identifier for the block.
example: "block1"

blocks.type: BlockType
Type of the block.
example: "product"

blocks.position: number
Position of the block for sorting.
example: 1

blocks.templateIdentifier: string | null
Identifier for the template used by the block, or null if not applicable.
example: "template1"

blocks.isVisible: boolean
Indicates whether the block is visible.
example: true

blocks.countElementsPerRow: number
Number of elements displayed per row in the block, if applicable.
example: 3

blocks.quantity: number
Quantity of items in the block, if applicable.
example: 5

blocks.similarProducts: IProductsResponse
Response containing similar products associated with the block.
example:

{
"total": 10,
"items": []
}

blocks.products: IProductsEntity[]
Array of product entities associated with the block.
example:

[
{
"id": 1,
"name": "Product 1"
},
{
"id": 2,
"name": "Product 2"
}
]

moduleFormConfigs: Array<IFormConfig>
Module form configurations linked to the page.

rating: IRating
Rating data.

total: string
Total number of products linked to the page.
example: "10"

categoryPath: string | null
Category path string; null for nested pages that have no own category path.
example: "catalog"


Usage examples

Step-by-step walkthrough in the documentation:

Try it live

Run this method interactively in the JS SDK sandbox — connect your Project URL and App Token on first visit, then open: