Brightspot CMS Developer Guide

Web database

Access data from other instances of Brightspot with the Web Database tool. From the Code Playground editor, you can query objects that exist in other Brightspot instances. The return of Article objects from another instance is shown below:

WebDatabase web = new WebDatabase();
web.setRemoteUrl(http://localhost:8080/_debug/db-web);return Query.from(Article.class).where.("title startsWith foo").using(web).select(0,10);

You can also move objects from one database to the other. Once returned, the required type ID is set. This works for when instances of objects are to be moved into the same model. Below is an example of objects moving from a dev to a qa instance of a site:

WebDatabase web = new WebDatabase();
Article article = Query.from(Article.class).where("_id = ID_HERE").using(web).first();
State articleState = article.getState();
ObjectType objectType = ObjectType.getInstance(Article.class);
return article;

Just as APIs can be ingested into Brightspot, objects in Brightspot can also be exported using the Dari API tool, DB-Web found in /_debug/db-web/. To begin, create a query using the /_debug/code/ tool and provide the query group data to the DB-Web tool.

Create the query for the API in the /_debug/code tool.

An example query for articles in the database:

public class Code {
    public static Object main() throws Throwable {
        return ObjectUtils.toJson(Query.from(Article.class).getState().getSimpleValues());

The getSimpleValues() method returns a map of all values converted to only simple types. The getState() method returns the state of the object being queried.

Click Run to run the query, the results should display in the Result section on the right side of the page. Copy the group data between the braces:


Go to db-web tool located here /_debug/db-web, and in the URL string append the group data as such:

/_debug/db-web?action=readFirst&query={“group data”}

Other action operation options include:

/_debug/db-web?action=readPartial&query={“group data”}

/_debug/db-web?action=readPartial&offset=“offset number”&query={“group data”}

/_debug/db-web?action=readAll&query={“group data”}

/_debug/db-web?action=readCount&query={“group data”}

/_debug/db-web?action=readLastUpdate&query={“group data”}}

Previous Topic
Performance Stats
Next Topic
Configuring Dari
Was this topic helpful?
Thanks for your feedback.
The elements that get you up and running in a matter of days, from pre-built content types, to modules, to landing pages.

Content types
Landing pages
Everything you need to manage and administer content within Brightspot CMS.

Admin configurations
A guide for installing, supporting and administering code on the Brightspot platform.

Field types
Content modeling
Rich-text elements
A guide for configuring different integrations to support a multitude of use cases.

Google Analytics
Apple News