Don't forget to check out our JSON RESTful APIs, they can help you utilize and extend Quickbase with ease.
Overview
Use API_GenResultsTable to embed a Quickbase table report in an HTML page.
This call is typically used in its URL form embedded in an HTML page. When the HTML page is opened in a browser, the call runs automatically and returns results to qdbWrite() for display in the HTML page.
You can also specify that the results should be returned as a JavaScript array, in CSV format, or as tab separated values.
By default, API_GenResultsTable returns the same number of rows as would be returned in the UI. However, you can specify a different number of rows in your table by including num-n in the options parameter.
You can split a result set into several tables by calling API_GenResultsTable once for each table, using the skp option after the first invocation to skip over the records already returned.
Embedding a Quickbase report into a Web page
Use the following procedure to embed a Quickbase report into a Web page on your Web site:
-
In your Quickbase application, create the table report that you want to embed.
Note: API_GenResultsTable can only be used with table reports.
-
In the HEAD section of your Web page, add the following <script> block:
<script lang="javascript" src="https://target_domain/db/
target_dbid?a=API_GenResultsTable&qid=5&jht=1&ticket=auth_ticket">
</script>In this block, the target_dbid should be the table ID you want and auth_ticket should be replaced with a valid authentication ticket. (If you don’t supply a ticket, the Quickbase login form appears when the page is opened and the user will have to log in first.) You can also supply your own query here, replacing the query id (qid) above with your own query id. See API_DoQuery for information on building a query.
-
In the HEAD section of your Web page, add the following style information:
<style>
td.m { font-family:verdana; font-size:70%; }
td.hd { font-family:verdana; font-size:70%; font-weight:bold; color:white;}
</style>By changing the attributes of these CSS tags, you can modify the format of the resulting table.
-
In the area of the Web page where you want the HTML table to display, add the following JavaScript code:
<script lang="javascript">
qdbWrite();
</script>
Request parameters
Parameter | Value | Required? |
---|---|---|
query or qid or qname |
Specifies the query. You can use any of these three options:
|
no |
clist |
A period-delimited list of field IDs to be returned. Quickbase will return values for these field IDs in the order in which you enter them here. To return all fields in a table, set this parameter to the value a. Omit this parameter if you want the query to return the table's default columns. |
no |
slist |
A period-delimited list of field IDs used to determine sorting as follows:
The following slist parameter sorts all records by the field whose fid is 7.
You can specify a secondary sort by including another fid in the string (separating each fid with a period)
URL example:
If you don’t specify the sort list, the default sort specified on the Report Layout page determines the order in which records are displayed. |
no |
jht |
Returns the HTML for a table as a JavaScript function named Set the value of the parameter to ‘n’ if you want the new look and feel introduced on Apr-12-2003. Set the value of this parameter ‘1’ if you want the CSS styles that render the HTML table with the Quickbase look and feel prior to Apr-11-2003. |
yes |
jsa |
Set this parameter to 1 if you want the results returned as a JavaScript array. |
no |
options |
A period-delimited list containing any or any combination of the following options:
|
yes |
ticket |
A valid authentication ticket. The authentication ticket is returned via the API_Authenticate call. |
yes, one of:
|
usertoken |
The user token is an alternative means of authentication, used for API access. User tokens cannot be used to access the Quickbase UI. |
yes, one of:
|
apptoken |
A valid application token. |
yes, if the application requires application tokens |
udata |
A string value that you want returned. It will not be handled by Quickbase but it will be returned in the response. |
no |
Response values
If you specify the jht option, the results are written to qbdWrite()
embedded in the HTML page. Optionally, if you specify CSV or tab in the options parameter, the return will be comma separated values (CSV) or tab separated values, respectively. If you specified jsa, the JavaScript array is returned.
Sample XML Request
POST https://target_domain/db/target_dbid
HTTP/1.0
Content-Type: application/xml
Content-Length:
QUICKBASE-ACTION: API_GenResultsTable
<qdbapi>
<ticket>auth_ticket</ticket>
<apptoken>app_token</apptoken>
<query>{'11'.CT.'Bob'}AND{'19'.GTE.'5'}</query>
<clist>6.7.9.11.16</clist>
<slist>11.6</slist>
<fmt>structured</fmt>
<options>num-4.sortorder-D</options>
</qdbapi>
URL alternative
https://target_domain/db/target_dbid?a=API_GenResultsTable&ticket=
auth_ticket&apptoken=app_token&qid=5&jht=1&query=
{'6'.CT.'done'}AND{'14'.CT.'USA'}&clist=7.8&slist=6&options=sortorder-A
where target_domain is the domain against which you are invoking this call, for example, quickbase.com. Read about this notation.
A Sample Web Page HTML with an Embedded Table
<html>
<head>
<script lang="javascript" src="https://quickbase.com/db/5rh82jcq?a=API_GenResultsTable
&ticket=auth_ticket&apptoken=app_token
&qid=5&jht=1">
</script>
<style>
td.m { font-family:verdana; font-size:70%; }
td.hd { font-family:verdana; font-size:70%; font-weight:bold;
color:white;}
</style>
</head>
<body>
<h1>Example</h1>
<table cellpadding=5 bgcolor=lightgreen>
<tr>
<td valign=top
nowrap><b>A Quickbase table<br>embedded in
a<br>page
of HTML
</td>
<td>
<script
lang="javascript">
qdbWrite();
</script>
</td>
</tr>
</table>
</body>
</head>
</html>