Get root pages

In this example, we demonstrate how to retrieve all top-level (root) pages from the CMS using the OneEntry API.

โœ… Purpose of the scenario:
  • Connect to the OneEntry API
  • Retrieve all root-level pages in a single call
  • Access page metadata such as type, title, and product count
โœ… What you need:
  • A valid PROJECT_URL and APP_TOKEN for authentication with the OneEntry API.
  • At least one root-level page configured in OneEntry.
๐Ÿ“Œ Important:
  • These examples do not include error handling.
  • You can manage errors using a try-catch block or by employing a construction like await Promise.catch((error) => error).
  • getRootPages() returns a plain array, NOT { items, total }.
  • The type field is "common_page" for content pages and "catalog_page" for pages with products.
  • The products field on each page object shows the count of products assigned to that page.
๐Ÿ“š See in documentation:
๐Ÿ“ฆ SDK reference:
Loading sandboxโ€ฆ