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 parameter | Response |
_format=json | HTTP status code in JSON format. |
_format=js | JavaScript function that dynamically creates an iframe pointing to the requested page’s permalink.
|
_format=_frame | HTML document with an <iframe> pointing to the requested page’s permalink.
|
_format=json &_result=html | JSON representation of the response with two keys:
|
_format=jsonp &_callback=functionName | JavaScript function whose argument is a JSON representation of the response with two keys:
For example, if the function name is myfunc, the response is similar to the following:
|
_format=jsonp &_callback=functionName &_result=html | JavaScript function whose argument is a JSON representation of the response with two keys:
For example, if the function name is
|
_format=oembed | JSON representation of the requested page that can be embedded in a third-party site. For additional information about this format, see oEmbed. |
_renderer=json | JSON representation of the requested page as it is stored in the database, similar to the following:
|
_renderer=styleguide | JSON 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