Support

Access the data

Website administrators can easily modify website data using the Bear CMS UI and the developers can access this data to create unique experiences. Let's get familiar with the Data API.

Prerequisites

Currently, there are two Bear CMS client packages. Writing code for Bear CMS requires running Bear CMS as Bear Framework addon. Click here to learn about this package.

The Data API

Pages

Get a list of all created pages.
$list = $app->bearCMS->data->pages->getList(); foreach ($list as $page) { echo $page->id; }

Blog posts

Get a list of all created blog posts.
$list = $app->bearCMS->data->blogPosts->getList(); foreach ($list as $blogPost) { echo $page->title; }

Users

Get a list of all administrators (users).
$list = $app->bearCMS->data->users->getList(); foreach ($list as $user) { echo $page->id; }

Settings

Get information about the site settings.
$settings = $app->bearCMS->data->settings->get(); echo $settings->title;

Example code

A demo application is available at GitHub.
Almost every line in the source code is commented. We think this is the best way to get yourself familiar with the Data API.

Learn more