Share URLs and Embedding
Every shared item of Kvery has a stable address. The share windows show them, and you can also build them yourself.
Address formats
| Address | What it opens |
|---|---|
https://app.kvery.io/query/execute/hash/{hash} | The page of a shared query: its form and result |
https://app.kvery.io/query/api/{hash} | The public query API: the result as JSON |
https://app.kvery.io/dashboard/hash/{hash} | A shared dashboard |
https://app.kvery.io/deeplink?data=… | The mobile link: opens the shared query or dashboard in the Kvery mobile app |
https://app.kvery.io/swagger/{hash} | The Swagger page of a group |
https://app.kvery.io/swagger/data/{hash} | The OpenAPI document (JSON) of that Swagger page, for tools that import it |
{hash} is the identifier of the item as the share window shows it. A query's
Custom URL replaces the query's own part of it, and the $variables of a
custom URL are path segments that the caller fills in with letters, digits, _ or
- (for example users/$id is called as …/users/42).
The share windows
The Query sharing window of a query shows three blocks, each with a Copy to clipboard! button:
- Normal — the address of the shared query page.
- API (JSON) — the API endpoint, shown also while sharing is off. While sharing is off or the share has a password, the block notes "- Basic Auth (Username, Password)": API calls then need Basic Auth (see Calling a query that is not shared).
- Mobile — the mobile link with its QR code.
Normal and Mobile appear while sharing is on, and only when the method in
front of the Custom URL is All or GET; a URL limited to POST, PUT,
PATCH or DELETE has only the API endpoint. The Share dashboard window of a
dashboard shows the Normal and Mobile blocks while sharing is on.
Parameters in the address
- Form values — query-string parameters fill the
form variables of a shared query, for
example
…/query/execute/hash/{hash}?status=open. - Draft — an editor of the query who is signed in can open the
draft by adding
?draft. - Cache —
?cache=0bypasses the result cache (see Export and cache). - Dashboards — a dashboard passes every parameter of its own address to each
of its tiles:
…/dashboard/hash/{hash}?status=openfills the form variablestatusof every tile, and?draftand the display parameters below work the same way.
Display parameters
These parameters override the query's table settings on its pages:
| Parameter | Overrides |
|---|---|
hdscr=1 / hdscr=0 | Hide description in shared view? |
form=0 / form=1 | Hide form in shared view? (form=0 hides the form) |
sot=1 / sot=0 | Show only table in shared view? |
jsonSlug=1 / jsonSlug=0 | Slug JSON keys (response time may be slower) of the API endpoint |
responsive=1 / responsive=0 | Responsive? |
responsiveType=1 / responsiveType=0 | Responsive data in modal? |
scrollY=<pixels> | Table fix height in pixels (0 = disabled) |
fixedColumnsFromLeft=<n>, fixedColumnsFromRight=<n> | Fixed columns from left / right (without responsive mode) |
rowsPerPage=<n> | Rows per page (-1 shows every row) |
refresh=<seconds> | Auto refresh table (sec) (5 or more) |
Further parameters change the result view itself:
| Parameter | Effect |
|---|---|
dom=<layout> | Which controls surround the table, as a DataTables layout string: B buttons (Columns, CSV, Excel), f search box, r processing indicator, i row information, t the table, p pager. The default is Bfritip; dashboard tiles use Bftip. Characters outside that syntax are dropped, and an invalid value or one over 200 characters gives the default layout. The Kvery mobile app always uses ftip. |
chartType=<type> | Draws a query whose saved layout is a chart as another chart type: bar, horizontalBar, line, mixed, pie or doughnut. |
buttons[<label>]=<URL> | Adds a button with that label above the table; clicking it opens the URL (only http and https addresses) in the same frame. |
Embedding in a frame
A shared query page, a shared dashboard, the Swagger page and the API endpoint can
be shown in a frame (<iframe>) on a page of another site, and so can the run page
of a query with ?iframe=1 (it needs a viewer who is signed in to Kvery and may run
the query); the other pages of Kvery cannot.
<iframe src="https://app.kvery.io/query/execute/hash/{hash}?hdscr=1"
style="width: 100%; height: 600px; border: 0;"></iframe>
The page of a shared query fills its frame and shows the result in a frame of its
own, so give your frame the height you want. A shared dashboard does not report its
height either: give its frame a fixed height, and add ?iframe=1 to its address
to drop the padding around the tiles.
Height messages
The page that runs the query reports its content height to the page that frames
it with window.postMessage, each time the height changes. The message is an
object:
| Field | Value |
|---|---|
sender | "kolt" |
locationHref | The address of the run page |
documentHeight | The height of the content in pixels |
type | "documentReady" or "tableInitComplete" |
dashboardQueryId | The dashboardQueryId parameter of the run page's address, if any |
chart | 1 when the page shows a chart, otherwise 0 |
Kvery's own dashboards use dashboardQueryId and chart to size their tiles.
On the shared query page these messages go to the frame around the result, which
is part of Kvery's page. To receive them on your own page, frame the run page
itself: https://app.kvery.io/query/execute/hnif/{hash} (the same address with
hnif in place of hash), and listen for the messages:
window.addEventListener('message', (event) => {
if (event.origin !== 'https://app.kvery.io') return;
const data = event.data;
if (data && data.sender === 'kolt' && data.documentHeight) {
document.getElementById('kvery-frame').style.height = data.documentHeight + 'px';
}
});