·¬ÇÑÉçÇø

Brightspot CMS Developer Guide

URL query parameters


Dari provides URL query parameters to facilitate debugging. A query parameter is appended to a URL with a question mark (?) if it’s the first parameter in the query string, or an ampersand (&) if it is not the first parameter in the query string.

There are Dari query parameters to invoke the Contextual Debugger and Reloader. In addition, the following query parameters are available.


http://{yoursite.com}/{page}/?_cache=false

Dari automatically provides SQL query caching when returning objects. When the same content is requested in separate SQL queries, caching limits the number of queries to one, thereby consolidating queries.

To turn caching off, add ?_cache=false to the page request.

To see the difference between caching and not caching, use the Contextual Debugger, first with caching on (?_debug=true&_cache=true), and then with caching off (?_debug=true&_cache=false). Scroll down to the Dari Profile table, and examine the count for SQL with and without caching.


When serving a page, Brightspot normally assembles the response in HTML format using the view system. You can specify a different format, a technique that is helpful when debugging or embedding the response in a different page.

You specify the output format using a query parameter _format or _renderer as described in the following table.

Examples of using the query parameters include the following:

Query parameterResponse
_format=jsonHTTP status code in JSON format.
_format=jsJavaScript function that dynamically creates an iframe pointing to the requested page’s permalink.
(function(window, undefined) {
  d=window.document;
  f=d.createElement('IFRAME);
  f.src='http://example.com/recipe';
})
_format=_frameHTML document with an <iframe> pointing to the requested page’s permalink.
<html>
    <body>
        <iframe src="http://www.example.com/fast-food-found-on-exoplanet" 
></iframe>
    </body>
</html>
_format=json &_result=html

JSON representation of the response with two keys:

  • status: HTTP status code
  • result: Requested page as an escaped HTML string
_format=jsonp &_callback=functionName
JavaScript function whose argument is a JSON representation of the response with two keys:

  • status: HTTP status code
  • result: Requested page as an escaped HTML string

For example, if the function name is myfunc, the response is similar to the following:

myfunc({"
  status":"ok",
  "result":"<html><body><p>hello</p></body></html>});

_format=jsonp &_callback=functionName &_result=html

JavaScript function whose argument is a JSON representation of the response with two keys:

  • status: HTTP status code
  • result: Requested page as an escaped HTML string

For example, if the function name is myfunc, the response is similar to the following:

myfunc({"
  status":"ok",
  "result":"<html><body><p>hello</p></body></html>});

_format=oembedJSON representation of the requested page that can be embedded in a third-party site. For additional information about this format, see .
_renderer=jsonJSON representation of the requested page as it is stored in the database, similar to the following:
{
  "class" : "content.article.ArticleViewModel",
  "body" : "A survey of 5 million cat owners proved that cats are indeed better pets than dogs.",
  "headline" : "Cats Are Better Than Dogs"
}
_renderer=styleguideJSON representation of the requested page used to populate a template.

Examples of using the query parameters include the following:

  • http://<hostname>/cats-are-better-than-dogs?_renderer=json
  • http://<hostname>/cats-are-better-than-dogs?_renderer=styleguide
  • http://<hostname>/cats-are-better-than-dogs?_format=_frame
Previous Topic
Contextual debugging
Next Topic
Task Status
Was this topic helpful?
Thanks for your feedback.
Our robust, flexible Design System provides hundreds of pre-built components you can use to build the presentation layer of your dreams.

•
•
•
Brightspot is packaged with content types that get you up and running in a matter of days, including assets, modules and landing pages.

• Content types
• Modules
• Landing pages
Everything you need to know when creating, managing, and administering content within Brightspot CMS.

• Dashboards
• Publishing
• Workflows
• Admin configurations
A guide for installing, supporting, extending, modifying and administering code on the Brightspot platform.

• Field types
• Content modeling
• Rich-text elements
• Images
A guide to configuring Brightspot's library of integrations, including pre-built options and developer-configured extensions.

• Google Analytics
• Shopify
• Apple News