NAV Navbar
javascript--node javascript--browser php

Introduction

Welcome to quickbase.dev! This site is dedicated to providing information and help on how to navigate Quick Base's API.

The featured libraries are all designed to be flexible, portable, easy, and fun to use. We have examples in PHP and JavaScript! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

All the featured libraries are hosted on GitHub and are open and welcome to submissions.

Additionally, all the featured libraries are available for use under their respective Apache-2.0 licenses found in each respective repository.

We are continually trying to improve the information available! Please feel free to submit an issue or a pull request to help us improve!

Support

The featured libraries are open-source projects open and welcome to all submissions.

Please keep all support requests to their respective GitHub repositories. For example, for a PHP issue please do not open an issue in the node repository, open it in the PHP repository.

FAQ

How do I debug?

// Windows
$ SET DEBUG=* && node path/to/script.js

// Unix
$ DEBUG=* node path/to/script.js
window.localStorage.debug = '*';
window.location.reload(); // You have to refresh for the changes to take hold
<?php

$quickbase = new \QuickBase\QuickBase(array( ... ));

$quickbase->debug = true;

?>

In JavaScript, the libraries make good use of the debug library.

If you are in the browser, to engage the debug functionality, open your developer tools console and enter window.localStorage.debug = '*';. Then refresh the page. Any API calls will now be logged directly to the console so you know exactly what is being sent to Quick Base and what is being sent back.

If you are use Nodejs, you'll have to set the DEBUG environment variable, for Windows SET DEBUG=*, for unix based systems DEBUG=*. Any API calls will now be logged directly to stdout so you know exactly what is being sent to Quick Base and what is being sent back.

In PHP, the library has a very rudamentary system. If you set the QuickBase instance public property debug to true, then the library will var_dump all outgoing requests, but not incoming responses. You can accomplish the same feat by var_dump'ing the result of your api() method call.

Requirements

Below are the requirements for various platforms.

Also, while not a requirement, if you are working on a Windows machine, I highly recommend using cmder to interact with Nodejs or PHP via the command line.

You can find cmder here: https://cmder.net/

Browser

The libraries detailed in this document are transpiled to and made available in ECMAScript2015 ("ES 5"), thus any browser that supports ES 5 or greater, supports these libraries.

You can find out what browsers support ES 5 here: https://kangax.github.io/compat-table/es5/

(Hint: All modern browsers support ES 5.)

Server

Nodejs

Version 4.0.0 or greater

To install Nodejs, please visit their website here: https://nodejs.org/en/

You will also require npm, which is Nodejs's package manager. Depending on how you install Nodejs, npm is most likely included. If it wasn't, you can find help here: https://www.npmjs.com/get-npm

PHP

Version 5.4.0 or greater

PHP extensions CURL and XML are also required

To install PHP, please find help here: https://secure.php.net/manual/en/install.php

You will also require composer, which is a PHP package manager. To install composer, please visit here: https://getcomposer.org/download/

QuickBase

This is the low level Quick Base class, giving you direct access to Quick Base's API.

This class is utilized in the abstraction layers QBField, QBRecord and QBTable.

Installation & Loading

// $ npm install --save quickbase

const QuickBase = require('quickbase');
// <script type="text/javascript" src="quickbase.browserify.min.js"></script>
<?php

// $ composer require tflanagan/quickbase

require_once(__DIR__.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php');

?>

Installing the Quick Base library for your desired platform requires either including the browserified version of the library in your HTML page or installing it via a package manager (npm or composer).

Including the library for use in your code depends on your platform.

Initialization

const quickbase = new QuickBase({
  realm: 'subdomain/realm',
  userToken: 'user token',
  appToken: 'application token',
  flags: {
    msInUTC: true,
    encoding: 'ISO-8859-1'
  },
  connectionLimit: 10,
  errorOnConnectionLimit: false
});
var quickbase = new QuickBase({
  realm: 'subdomain/realm',
  userToken: 'user token',
  appToken: 'application token',
  flags: {
    msInUTC: true,
    encoding: 'ISO-8859-1'
  },
  connectionLimit: 10,
  errorOnConnectionLimit: false
});
<?php

$quickbase = new \QuickBase\QuickBase(array(
  'realm' => 'subdomain/realm',
  'userToken' => 'user token',
  'appToken' => 'application token',
  'flags' => array(
    'msInUTC' => true,
    'encoding' => 'ISO-8859-1'
  )
));

?>
Parameter Required Default Description
realm true Quick Base Realm (or subdomain)
appToken false Quick Base Application Token
userToken false Quick Base User Token
flags false Object containing a collection of API parameters
- msInUTC false true Interpret all timestamps as milliseconds in UTC rather than using the local application time
- encoding false ISO-8859-1 The encoding used to make requests to and parse responses from Quick Base
connectionLimit true 10 (JavaScript Only) Maximum number of simultaneous API requests
errorOnConnectionLimit false false (JavaScript Only) Throw an error if the connectionLimit is exceeded

Making an API Call

The Quick Base librarys are built in such a way as to be as future-proof as possible. 9/10 times, a new API endpoint will automatically be supported if you're using these libraries.

The way we accomplish this is by exposing a single method api().

.api(action[, options])

quickbase.api('SomeAPI_Action', {
  dbid: 'bddnn3uz9',
  someFutureProperty: 'lorem ipsum'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('SomeAPI_Action', {
  dbid: 'bddnn3uz9',
  someFutureProperty: 'lorem ipsum'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('SomeAPI_Action', array(
    'dbid' => 'bddnn3uz9',
    'someFutureProperty' => 'lorem ipsum'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>
Parameter Required Default Description
action true The Quick Base API Action you wish to execute (ie: API_DoQuery)
options false An object containing data pertaining to your API Action

In JavaScript, the api() method returns a Promise, powered by bluebirdjs. If an error occurs during the request, you can handle the error by using catch(). Otherwise, you can continue processing with the results passed into a then().

In PHP, the api() method returns the resulting JSON object from the API call. If an error occurs, it will be thrown and needs to be caught with a try/catch statement.

Quick Base API Endpoints

The following is a list of Quick Base API Endpoints mostly compiled from Quick Base's own help section.

Each endpoint has an overview of the endpoint and what it supports, an example of using it in code, what the response from Quick Base looks like in JSON, and a link to Quick Base's help section for that specific endpoint.

This list may not contain everything that is supported. As these libraries are future-proof, if Quick Base comes out with a new endpoint, it will be automatically supported - so long as Quick Base hasn't changed too much. We will try to keep this update to date, time allowing. To that note, Quick Base's documentation is the ultimate authority in regards to what is supported.

API_AddField

quickbase.api('API_AddField', {
  dbid: 'bddnn3uz9',
  add_to_forms: true,
  label: 'Label',
  mode: 'virtual',
  type: 'formula'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_AddField', {
  dbid: 'bddnn3uz9',
  add_to_forms: true,
  label: 'Label',
  mode: 'virtual',
  type: 'formula'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_AddField', array(
    'dbid' => 'bddnn3uz9',
    'add_to_forms' => true,
    'label' => 'Label',
    'mode' => 'virtual',
    'type' => 'formula'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_AddField",
  "errcode": 0,
  "errtext": "No error",
  "fid": 8,
  "label": "Label"
}

Quick Base Documentation

Parameter Required Default Description
dbid true
add_to_forms false false
label true
mode Lookup/Formula only
type true

Possible type values:

UI: TYPE API: TYPE
Checkbox checkbox
Date date
Duration duration
Email Address email
File Attachment file
Formula any other type
Lookup text or float
List - User multiuserid
Multi-Select Text multitext
Numeric float
Numeric - Currency currency
Numeric - Percent percent
Numeric - Rating rating
Phone Number phone
Report Link dblink
Text text
Time Of Day timeofday
URL url
User userid

API_AddGroupToRole

quickbase.api('API_AddField', {
  dbid: 'bddnn3uz9',
  gid: '345889.ksld',
  roleid: 12
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_AddField', {
  dbid: 'bddnn3uz9',
  gid: '345889.ksld',
  roleid: 12
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php
try {
  $results = $quickbase->api('API_AddField', array(
    'dbid' => 'bddnn3uz9',
    'gid' => '345889.ksld',
    'roleid' => 12
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_AddGroupToRole",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
gid true
roleid true

API_AddRecord

quickbase.api('API_AddRecord', {
  dbid: 'bddnn3uz9',
  fields: [
    { fid: 6, value: 'Hello World!' }
  ],
  disprec: false,
  fform: false,
  ignoreError: false,
  msInUTC: false,
  msAsDurationDefault: false
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_AddRecord', {
  dbid: 'bddnn3uz9',
  fields: [
    { fid: 6, value: 'Hello World!' }
  ],
  disprec: false,
  fform: false,
  ignoreError: false,
  msInUTC: false,
  msAsDurationDefault: false
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_AddRecord', array(
    'dbid' => 'bddnn3uz9',
    'fields' => array(
      array( 'fid' => 6, 'value' => 'Hello World!' )
    ),
    'disprec' => false,
    'fform' => false,
    'ignoreError' => false,
    'msInUTC' => false,
    'msAsDurationDefault' => false
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_AddRecord",
  "errcode": 0,
  "errtext": "No error",
  "rid": 21,
  "update_id": 1206177014451
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
fields true
disprec false false
fform false false
ignoreError false false
msInUTC false global instance setting
msAsDurationDefault false false

API_AddReplaceDBPage

// Adding a new DB Page
quickbase.api('API_AddReplaceDBPage', {
  dbid: 'bddnn3uz9',
  pagename: 'newpage.html',
  pagetype: 1,
  pagebody: '<html></html>'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});

// Updating an existing DB Page
quickbase.api('API_AddReplaceDBPage', {
  dbid: 'bddnn3uz9',
  pagename: 'newpage.html',
  pageid: 12,
  pagetype: 1,
  pagebody: '<html></html>'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
// Adding a new DB Page
quickbase.api('API_AddReplaceDBPage', {
  dbid: 'bddnn3uz9',
  pagename: 'newpage.html',
  pagetype: 1,
  pagebody: '<html></html>'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});

// Updating an existing DB Page
quickbase.api('API_AddReplaceDBPage', {
  dbid: 'bddnn3uz9',
  pagename: 'newpage.html',
  pageid: 12,
  pagetype: 1,
  pagebody: '<html></html>'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

// Adding a new DB Page
try {
  $results = $quickbase->api('API_AddReplaceDBPage', array(
    'dbid' => 'bddnn3uz9',
    'pagename' => 'newpage.html',
    'pagetype' => 1,
    'pagebody' => '<html></html>'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

// Updating an existing DB Page
try {
  $results = $quickbase->api('API_AddReplaceDBPage', array(
    'dbid' => 'bddnn3uz9',
    'pagename' => 'newpage.html',
    'pageid' => 12,
    'pagetype' => 1,
    'pagebody' => '<html></html>'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_AddReplaceDBPage",
  "errcode": 0,
  "errtext": "No error",
  "pageID": 12
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
pagename true
pageid true, if updating
pagetype true
pagebody true

API_AddSubGroup

quickbase.api('API_AddSubGroup', {
  gid: '345889.sdfs',
  subgroupid: '820935.ksjf'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_AddSubGroup', {
  gid: '345889.sdfs',
  subgroupid: '820935.ksjf'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_AddSubGroup', array(
    'gid' => '345889.sdfs',
    'subgroupid' => '820935.ksjf'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_AddSubGroup",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
gid true
subgroupid true

API_AddUserToGroup

quickbase.api('API_AddUserToGroup', {
  gid: '345889.sdfd',
  userid: '898790.qntp',
  allowAdminAccess: false
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_AddUserToGroup', {
  gid: '345889.sdfd',
  userid: '898790.qntp',
  allowAdminAccess: false
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_AddUserToGroup', array(
    'gid' => '345889.sdfd',
    'userid' => '898790.qntp',
    'allowAdminAccess' => false
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_AddUserToGroup",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
gid true
uid true
email false
screenName false
allowAdminAccess false false

API_AddUserToRole

quickbase.api('API_AddUserToRole', {
  dbid: 'bddnn3uz9',
  userid: '112245.efy7',
  roleid: 10
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_AddUserToRole', {
  dbid: 'bddnn3uz9',
  userid: '112245.efy7',
  roleid: 10
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_AddUserToRole', array(
    'dbid' => 'bddnn3uz9',
    'userid' => '112245.efy7',
    'roleid' => 10
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_AddUserToRole",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
userid true
roleid true

API_Authenticate

quickbase.api('API_Authenticate', {
  username: 'PTBarnum',
  password: 'TopSecret',
  hours: 12
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_Authenticate', {
  username: 'PTBarnum',
  password: 'TopSecret',
  hours: 12
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_Authenticate', array(
    'username' => 'PTBarnum',
    'password' => 'TopSecret',
    'hours' => 12
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_Authenticate",
  "errcode": 0,
  "errtext": "No error",
  "ticket": "2_beeinrxmv_dpvx_b_crf8ttndjwyf9bui94rhciirqcs",
  "userid": "112245.efy7"
}

Quick Base Documentation

Parameter Required Default Description
username true
password true
hours false 12

API_ChangeGroupInfo

quickbase.api('API_ChangeGroupInfo', {
  gid: '345889.sdjl',
  name: 'AcmeSalesTeamLeads',
  description: 'Team Leaders for the Acme division',
  accountID: 456789,
  allowsAdminAccess: false
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_ChangeGroupInfo', {
  gid: '345889.sdjl',
  name: 'AcmeSalesTeamLeads',
  description: 'Team Leaders for the Acme division',
  accountID: 456789,
  allowsAdminAccess: false
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_ChangeGroupInfo', array(
    'gid' => '345889.sdjl',
    'name' => 'AcmeSalesTeamLeads',
    'description' => 'Team Leaders for the Acme division',
    'accountID' => 456789,
    'allowsAdminAccess' => false
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_ChangeGroupInfo",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
gid true
name false
description false
accountId false

API_ChangeManager

quickbase.api('API_ChangeManager', {
  dbid: 'bddnn3uz9',
  newmgr: 'angela_leon@gmail.com'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_ChangeManager', {
  dbid: 'bddnn3uz9',
  newmgr: 'angela_leon@gmail.com'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_ChangeManager', array(
    'dbid' => 'bddnn3uz9',
    'newmgr' => 'angela_leon@gmail.com'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_ChangeManager",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
newmgr true

API_ChangeRecordOwner

quickbase.api('API_ChangeRecordOwner', {
  dbid: 'bddnn3uz9',
  rid: 3,
  newowner: 'Muggsy'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_ChangeRecordOwner', {
  dbid: 'bddnn3uz9',
  rid: 3,
  newowner: 'Muggsy'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_ChangeRecordOwner', array(
    'dbid' => 'bddnn3uz9',
    'rid' => 3,
    'newowner' => 'Muggsy'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_ChangeRecordOwner",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
rid or key true
newowner true

API_ChangeUserRole

quickbase.api('API_ChangeUserRole', {
  dbid: 'bddnn3uz9',
  userid: '112248.5nzg',
  roleid: 11,
  newroleid: 12
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_ChangeUserRole', {
  dbid: 'bddnn3uz9',
  userid: '112248.5nzg',
  roleid: 11,
  newroleid: 12
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_ChangeUserRole', array(
    'dbid' => 'bddnn3uz9',
    'userid' => '112248.5nzg',
    'roleid' => 11,
    'newroleid' => 12
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_ChangeUserRole",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
userid true
roleid true
newroleid false 9

API_CloneDatabase

quickbase.api('API_CloneDatabase', {
  dbid: 'bddnn3uz9',
  newdbname: 'YellowDots',
  newdbdesc: 'Database copy with no data',
  keepData: true,
  exludeFiles: true,
  usersandroles: false
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_CloneDatabase', {
  dbid: 'bddnn3uz9',
  newdbname: 'YellowDots',
  newdbdesc: 'Database copy with no data',
  keepData: true,
  exludeFiles: true,
  usersandroles: false
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_CloneDatabase', array(
    'dbid' => 'bddnn3uz9',
    'newdbname' => 'YellowDots',
    'newdbdesc' => 'Database copy with no data',
    'keepData' => true,
    'exludeFiles' => true,
    'usersandroles' => false
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_CloneDatabase",
  "errcode": 0,
  "errtext": "No error",
  "newdbid": "bddnc6pn7"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
newdbname true
newdbdesc false
keepData false false
excludefiles false true
usersandroles false false

API_CopyGroup

quickbase.api('API_CopyGroup', {
  gid: '1213.dsfj',
  name: 'SalesTeamLeadsCopy',
  description: 'Copy of the current Sales Team Leads Group',
  gacct: ''
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_CopyGroup', {
  gid: '1213.dsfj',
  name: 'SalesTeamLeadsCopy',
  description: 'Copy of the current Sales Team Leads Group',
  gacct: ''
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_CopyGroup', array(
    'gid' => '1213.dsfj',
    'name' => 'SalesTeamLeadsCopy',
    'description' => 'Copy of the current Sales Team Leads Group',
    'gacct' => ''
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_CopyGroup",
  "errcode": 0,
  "errtext": "No error",
  "group": {
    "id" => "1219.d47h",
    "name" => "SalesTeamLeadsCopy",
    "description" => "Copy of the current Sales Team Leads Group",
    "managedByUser" => true
  }
}

Quick Base Documentation

Parameter Required Default Description
gid true
name true
description false
gacct false account for the source group

API_CopyMasterDetail

quickbase.api('API_CopyMasterDetail', {
  dbid: 'bddnn3uz9',
  destrid: 0,
  sourcerid: 1,
  copyfid: 6,
  recurse: true,
  relfids: 'all'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_CopyMasterDetail', {
  dbid: 'bddnn3uz9',
  destrid: 0,
  sourcerid: 1,
  copyfid: 6,
  recurse: true,
  relfids: 'all'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_CopyMasterDetail', array(
    'dbid' => 'bddnn3uz9',
    'destrid' => 0,
    'sourcerid' => 1,
    'copyfid' => 6,
    'recurse' => true,
    'relfids' => 'all'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_CopyMasterDetail",
  "errcode": 0,
  "errtext": "No error",
  "parentrid": 1,
  "numcreated": 4
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
destrid true
sourcerid true
copyfid true
recurse false true
relfids false all

API_CreateDatabase

quickbase.api('API_CreateDatabase', {
  dbname: 'FuelCharter',
  dbdesc: 'Vehicle and Fuel Cost Tracker',
  createapptoken: true
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_CreateDatabase', {
  dbname: 'FuelCharter',
  dbdesc: 'Vehicle and Fuel Cost Tracker',
  createapptoken: true
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_CreateDatabase', array(
    'dbname' => 'FuelCharter',
    'dbdesc' => 'Vehicle and Fuel Cost Tracker',
    'createapptoken' => true
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_CreateDatabase",
  "errcode": 0,
  "errtext": "No error"
  "dbid": 'bddnn3uz9',
  "appdbid": 'bddnn3ub7',
  "apptoken": 'cmzaaz3dgdmmwwksdb7zcd7a9wg'
}

Quick Base Documentation

Parameter Required Default Description
dbname true
dbdesc true
createapptoken false false

API_CreateGroup

quickbase.api('API_CreateGroup', {
  name: 'MarketingSupport',
  description: 'Support staff for sr marketing group',
  accountID: 456789
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_CreateGroup', {
  name: 'MarketingSupport',
  description: 'Support staff for sr marketing group',
  accountID: 456789
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_CreateGroup', array(
    'name' => 'MarketingSupport',
    'description' => 'Support staff for sr marketing group',
    'accountID' => 456789
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_CreateGroup",
  "errcode": 0,
  "errtext": "No error",
  "group": {
    "id" => "1219.d47h",
    "name" => "SalesTeamLeadsCopy",
    "description" => "Copy of the current Sales Team Leads Group",
    "managedByUser" => true
  }
}

Quick Base Documentation

Parameter Required Default Description
name true
description true
accountID false

API_CreateTable

quickbase.api('API_CreateTable', {
  dbid: 'bddnn3uz9',
  tname: 'My Vehicle List',
  pnoun: 'Vehicles'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_CreateTable', {
  dbid: 'bddnn3uz9',
  tname: 'My Vehicle List',
  pnoun: 'Vehicles'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_CreateTable', array(
    'dbid' => 'bddnn3uz9',
    'tname' => 'My Vehicle List',
    'pnoun' => 'Vehicles'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_CreateTable",
  "errcode": 0,
  "errtext": "No error",
  "newdbid": "bddfa5nbx"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
tname false Records
pnoun false Records

API_DeleteDatabase

quickbase.api('API_DeleteDatabase', {
  dbid: 'bddnn3uz9'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_DeleteDatabase', {
  dbid: 'bddnn3uz9'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_DeleteDatabase', array(
    'dbid' => 'bddnn3uz9'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_DeleteDatabase",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application or Table DBID

API_DeleteField

quickbase.api('API_DeleteField', {
  dbid: 'bddnn3uz9',
  fid: 6
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_DeleteField', {
  dbid: 'bddnn3uz9',
  fid: 6
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_DeleteField', array(
    'dbid' => 'bddnn3uz9',
    'fid' => 6
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_DeleteField",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
fid true

API_DeleteGroup

quickbase.api('API_DeleteGroup', {
  gid: '345889.skef'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_DeleteGroup', {
  gid: '345889.skef'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_DeleteGroup', array(
    'gid' => '345889.skef'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_DeleteGroup",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
gid true

API_DeleteRecord

quickbase.api('API_DeleteRecord', {
  dbid: 'bddnn3uz9',
  rid: 6
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_DeleteRecord', {
  dbid: 'bddnn3uz9',
  rid: 6
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_DeleteRecord', array(
    'dbid' => 'bddnn3uz9',
    'rid' => 6
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_DeleteRecord",
  "errcode": 0,
  "errtext": "No error",
  "rid": 6
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
rid or key true

API_DoQuery

quickbase.api('API_DoQuery', {
  dbid: 'bddnn3uz9',
  query: "{'5'.CT.'Ragnar Lodbrok'}AND{'5'.CT.'Acquisitions'}",
  /* qid: 1, */
  /* qname: 'List All', */
  clist: '3',
  slist: '3',
  options: 'num-r.sortorder-A.skp-10.onlynew',
  fmt: 'structured',
  returnpercentage: true,
  includeRids: true
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_DoQuery', {
  dbid: 'bddnn3uz9',
  query: "{'5'.CT.'Ragnar Lodbrok'}AND{'5'.CT.'Acquisitions'}",
  /* qid: 1, */
  /* qname: 'List All', */
  clist: '3',
  slist: '3',
  options: 'num-r.sortorder-A.skp-10.onlynew',
  fmt: 'structured',
  returnpercentage: true,
  includeRids: true
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_DoQuery', array(
    'dbid' => 'bddnn3uz9',
    'query' => "{'5'.CT.'Ragnar Lodbrok'}AND{'5'.CT.'Acquisitions'}",
    /* 'qid' => 1, */
    /* 'qname' => 'List All', */
    'clist' => '3',
    'slist' => '3',
    'options' => 'num-r.sortorder-A.skp-10.onlynew',
    'fmt' => 'structured',
    'returnpercentage' => true,
    'includeRids' => true
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_DoQuery",
  "errcode": 0,
  "errtext": "No error",
  "qid": -1,
  "qname": "",
  "table": {
    "name": "API created Sample",
    "desc": "This is a sample table.",
    "original": {
      "table_id": "bh9ckdaue",
      "app_id": "bh9ckc9ft",
      "cre_date": 1204586581894,
      "mod_date": 1206583187767,
      "next_record_id": 34,
      "next_field_id": 24,
      "next_query_id": 5,
      "def_sort_fid": 6,
      "def_sort_order": 1
    },
    "variables": {
      "Blue": 14,
      "Jack": 14,
      "Magenta": 12,
      "usercode": 14
    },
    "queries": [
      {
        "id": 1,
        "qyname": "List All",
        "qytype": "table",
        "qycalst": "0.0"
      }
    ],
    "fields": [
      {
        "id": 3,
        "field_type": "recordid",
        "base_type": "int32",
        "role": "recordid",
        "mode": "virtual",
        "label": "Record ID#",
        "nowrap": 1,
        "bold": 1,
        "required": 0,
        "appears_by_default": 0,
        "find_enabled": 1,
        "allow_new_choices": 0,
        "sort_as_given": 0,
        "default_value": 10,
        "carrychoices": 1,
        "foreignkey": 0,
        "unique": 1,
        "doesdatacopy": 0,
        "fieldhelp": "",
        "comma_start": 0,
        "does_average": 0,
        "does_total": 0,
        "blank_is_zero": 0
      }
    ],
    "lastluserid": 0,
    "lusers": [
      {
        "id": "112149.bhsv",
        "name": "AppBoss"
      }
    ],
    "records": [
      {
        "rid": 4,
        "3": 4
      }
    ]
  }
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
query or qid or qname false all
clist false default table columns
slist false default table sort
options false
fmt false global instance setting
returnpercentage false global instance setting
includeRids false global instance setting

API_DoQueryCount

quickbase.api('API_DoQueryCount', {
  dbid: 'bddnn3uz9',
  query: "{'7'.XCT.'blue car'}"
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_DoQueryCount', {
  dbid: 'bddnn3uz9',
  query: "{'7'.XCT.'blue car'}"
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_DoQueryCount', array(
    'dbid' => 'bddnn3uz9',
    'query' => "{'7'.XCT.'blue car'}"
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_DoQueryCount",
  "errcode": 0,
  "errtext": "No error",
  "numMatches": 1
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
query or qid or qname false all

API_EditRecord

quickbase.api('API_EditRecord', {
  dbid: 'bddnn3uz9',
  rid: 17,
  /* update_id: 1205700075470, */
  fields: [
    { fid: 6, value: 'Hi!' },
    { name: 'File Attachment', value: 'base64', filename: 'image.png' }
  ],
  disprec: false,
  fform: false,
  ignoreError: false,
  msInUTC: true
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_EditRecord', {
  dbid: 'bddnn3uz9',
  rid: 17,
  /* update_id: 1205700075470, */
  fields: [
    { fid: 6, value: 'Hi!' },
    { name: 'File Attachment', value: 'base64', filename: 'image.png' }
  ],
  disprec: false,
  fform: false,
  ignoreError: false,
  msInUTC: true
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_EditRecord', array(
    'dbid' => 'bddnn3uz9',
    'rid' => 17,
    /* 'update_id' => 1205700075470, */
    'fields' => array(
      array( 'fid' => 6, 'value' => 'Hi!' ),
      array( 'name' => 'File Attachment', 'value' => 'base64...', 'filename' => 'image.png' )
    ),
    'disprec' => false,
    'fform' => false,
    'ignoreError' => false,
    'msInUTC' => true
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_EditRecord",
  "errcode": 0,
  "errtext": "No error",
  "rid": 17,
  "num_fields_changed": 2,
  "update_id": 1205700275470
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
rid or key true
update_id false
fields true
disprec false false
fform false false
ignoreError false false
msInUTC false false

API_FieldAddChoices

quickbase.api('API_FieldAddChoices', {
  dbid: 'bddnn3uz9',
  fid: 11,
  choice: 'Don Tomas'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_FieldAddChoices', {
  dbid: 'bddnn3uz9',
  fid: 11,
  choice: 'Don Tomas'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_FieldAddChoices', array(
    'dbid' => 'bddnn3uz9',
    'fid' => 11,
    'choice' => 'Don Tomas'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_FieldAddChoices",
  "errcode": 0,
  "errtext": "No error",
  "fid": 11,
  "fname": "Fumables",
  "numadded": 1
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
fid true
choice true

API_FieldRemoveChoices

quickbase.api('API_FieldRemoveChoices', {
  dbid: 'bddnn3uz9',
  fid: 11,
  choice: 'Black'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_FieldRemoveChoices', {
  dbid: 'bddnn3uz9',
  fid: 11,
  choice: 'Black'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_FieldRemoveChoices', array(
    'dbid' => 'bddnn3uz9',
    'fid' => 11,
    'choice' => 'Black'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_FieldRemoveChoices",
  "errcode": 0,
  "errtext": "No error",
  "fid": 11,
  "fname": "Color Choice",
  "numremoved": 1
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
fid true
choice true

API_FindDBByName

quickbase.api('API_FindDBByName', {
  dbname: 'TestTable',
  ParentsOnly: false
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_FindDBByName', {
  dbname: 'TestTable',
  ParentsOnly: false
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_FindDBByName', array(
    'dbname' => 'TestTable',
    'ParentsOnly' => false
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_FindDBByName",
  "errcode": 0,
  "errtext": "No error",
  "dbid": "bdcagynhs"
}

Quick Base Documentation

Parameter Required Default Description
dbname true
ParentsOnly false false

API_GenAddRecordForm

quickbase.api('API_GenAddRecordForm', {
  dbid: 'bddnn3uz9',
  fields: [
    { name: 'Vehicle Make', value: 'Ford' }
  ]
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GenAddRecordForm', {
  dbid: 'bddnn3uz9',
  fields: [
    { name: 'Vehicle Make', value: 'Ford' }
  ]
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GenAddRecordForm', array(
    'dbid' => 'bddnn3uz9',
    'fields' => array(
      array( 'name' => 'Vehicle Make', 'value' => 'Ford' )
    )
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

Unlike most API calls, the above returns a string of the desired forms HTML rather than an object with properties.

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
fields true

API_GenResultsTable

quickbase.api('API_GenResultsTable', {
  dbid: 'bddnn3uz9',
  query: "{'11'.CT.'Bob'}AND{'19'.GTE.'5'}",
  /* qid: 1, */
  /* qname: 'List All', */
  clist: '6.7.9.11.16',
  slist: '11.6'
  options: 'num-4.sortorder-D',
  jht: 'n',
  jsa: false
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GenResultsTable', {
  dbid: 'bddnn3uz9',
  query: "{'11'.CT.'Bob'}AND{'19'.GTE.'5'}",
  /* qid: 1, */
  /* qname: 'List All', */
  clist: '6.7.9.11.16',
  slist: '11.6'
  options: 'num-4.sortorder-D',
  jht: 'n',
  jsa: false
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GenResultsTable', array(
    'dbid' => 'bddnn3uz9',
    'query' => "{'11'.CT.'Bob'}AND{'19'.GTE.'5'}",
    /* 'qid' => 1, */
    /* 'qname' => 'List All', */
    'clist' => '6.7.9.11.16',
    'slist' => '11.6'
    'options' => 'num-4.sortorder-D',
    'jht' => 'n',
    'jsa' => false
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

Unlike most API calls, the above returns a string of the desired table HTML rather than an object with properties.

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
query or qid or qname false all
clist false default table columns
slist false default table sort
options false
jht true
jsa false false

API_GetAncestorInfo

quickbase.api('API_GetAncestorInfo', {
  dbid: 'bddnn3uz9'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GetAncestorInfo', {
  dbid: 'bddnn3uz9'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GetAncestorInfo', array(
    'dbid' => 'bddnn3uz9'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_GetAncestorInfo",
  "errcode": 0,
  "errtext": "No error",
  "ancestorappid": "bbyhxrmsv",
  "oldestancestorappid": "bbyhxrmsv"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID

API_GetAppDTMInfo

quickbase.api('API_GetAppDTMInfo', {
  dbid: 'bddnn3uz9'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GetAppDTMInfo', {
  dbid: 'bddnn3uz9'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GetAppDTMInfo', array(
    'dbid' => 'bddnn3uz9'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_GetAppDTMInfo",
  "errcode": 0,
  "errtext": "No error",
  "RequestTime": 1227657049750,
  "RequestNextAllowedTime": 1227657049750,
  "app": {
    "id": "bdzk2ecg5",
    "lastModifiedTime": 1227657049750,
    "lastRecModTime": 1227647748330
  },
  "tables": [
    {
      "id": "bdzk2ecg6",
      "lastModifiedTime": 1227647748440,
      "lastRecModTime": 1227647748330
    },
    ...
  ]
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID

API_GetDBInfo

quickbase.api('API_GetDBInfo', {
  dbid: 'bddnn3uz9'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GetDBInfo', {
  dbid: 'bddnn3uz9'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GetDBInfo', array(
    'dbid' => 'bddnn3uz9'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_GetDBInfo",
  "errcode": 0,
  "errtext": "No error",
  "dbname" => "test",
  "lastRecModTime" => 1205806751959,
  "lastModifiedTime" => 1205877093679,
  "createdTime" => 1204745351407,
  "numRecords" => 3,
  "mgrID" => "112149.bhsv",
  "mgrName" => "AppBoss",
  "version" => "2.0",
  "time_zone" => "(UTC-08:00) Pacific Time (US & Canada)"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID

API_GetDBPage

quickbase.api('API_GetDBPage', {
  dbid: 'bguin9b8e',
  pageID: 3
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GetDBPage', {
  dbid: 'bguin9b8e',
  pageID: 3
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GetDBPage', array(
    'dbid' => 'bguin9b8e',
    'pageID' => 3
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_GetDBPage",
  "errcode": 0,
  "errtext": "No error",
  "pagebody": "<html></html>"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
pageID true

API_GetDBVar

quickbase.api('API_GetDBVar', {
  dbid: 'bguin9b8e',
  varname: 'usercode'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GetDBVar', {
  dbid: 'bguin9b8e',
  varname: 'usercode'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GetDBVar', array(
    'dbid' => 'bguin9b8e',
    'varname' => 'usercode'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_GetDBVar",
  "errcode": 0,
  "errtext": "No error",
  "value": 12
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
varname true

API_GetFieldProperties

quickbase.api('API_GetFieldProperties', {
  dbid: 'bddnn3uz9',
  fid: 3
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GetFieldProperties', {
  dbid: 'bddnn3uz9',
  fid: 3
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GetFieldProperties', array(
    'dbid' => 'bddnn3uz9',
    'fid' => 3
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_GetFieldProperties",
  "errcode": 0,
  "errtext": "No error",
  "field": {
    "id": 3,
    "field_type": "recordid",
    "base_type": "int32",
    "role": "recordid",
    "mode": "virtual",
    "label": "Record ID#",
    "nowrap": 1,
    "bold": 1,
    "required": 0,
    "appears_by_default": 0,
    "find_enabled": 1,
    "allow_new_choices": 0,
    "sort_as_given": 0,
    "default_value": 10,
    "carrychoices": 1,
    "foreignkey": 0,
    "unique": 1,
    "doesdatacopy": 0,
    "fieldhelp": "",
    "comma_start": 0,
    "does_average": 0,
    "does_total": 0,
    "blank_is_zero": 0
  }
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
fid true

API_GetGroupRole

quickbase.api('API_GetGroupRole', {
  dbid: 'bguin9b8e',
  gid: '345889.klsd'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GetGroupRole', {
  dbid: 'bguin9b8e',
  gid: '345889.klsd'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GetGroupRole', array(
    'dbid' => 'bguin9b8e',
    'gid' => '345889.klsd'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_GetGroupRole",
  "errcode": 0,
  "errtext": "No error",
  "roles": [
    {
      "id": 23528,
      "name": "Human Resources"
    },
    ...
  ]
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
gid true

API_GetNumRecords

quickbase.api('API_GetNumRecords', {
  dbid: 'bddnn3uz9'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GetNumRecords', {
  dbid: 'bddnn3uz9'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GetNumRecords', array(
    'dbid' => 'bddnn3uz9'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_GetNumRecords",
  "errcode": 0,
  "errtext": "No error",
  "num_records": 17
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID

API_GetRecordAsHTML

quickbase.api('API_GetRecordAsHTML', {
  dbid: 'bguin9b8e',
  rid: 2,
  dfid: 10
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GetRecordAsHTML', {
  dbid: 'bguin9b8e',
  rid: 2,
  dfid: 10
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GetRecordAsHTML', array(
    'dbid' => 'bguin9b8e',
    'rid' => 2,
    'dfid' => 10
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

Unlike most API calls, the above returns a string of the desired forms HTML rather than an object with properties.

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
rid or key true
dfid false

API_GetRecordInfo

quickbase.api('API_GetRecordInfo', {
  dbid: 'bguin9b8e',
  rid: 2
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GetRecordInfo', {
  dbid: 'bguin9b8e',
  rid: 2
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GetRecordInfo', array(
    'dbid' => 'bguin9b8e',
    'rid' => 2
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_GetRecordInfo",
  "errcode": 0,
  "errtext": "No error",
  "rid": 2,
  "num_fields": 28,
  "update_id": 1205780029699,
  "field": [
    {
      "fid": 26,
      "name": "Parent Page",
      "type": "Numeric",
      "value": 166
    },
    ...
  ]
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
rid or key true

API_GetRoleInfo

quickbase.api('API_GetRoleInfo', {
  dbid: 'bddnn3uz9'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GetRoleInfo', {
  dbid: 'bddnn3uz9'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GetRoleInfo', array(
    'dbid' => 'bddnn3uz9'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_GetRoleInfo",
  "errcode": 0,
  "errtext": "No error",
  "roles": [
    {
      "id": 11,
      "name": "Participant",
      "access": {
        "id": 3,
        "name": "Basic Access"
      }
    },
    ...
  ]
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID

API_GetSchema

quickbase.api('API_GetSchema', {
  dbid: 'bddnn3uz9'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GetSchema', {
  dbid: 'bddnn3uz9'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GetSchema', array(
    'dbid' => 'bddnn3uz9'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_GetSchema",
  "errcode": 0,
  "errtext": "No error",
  "time_zone": "(UTC-05:00) Eastern Time (US & Canada)",
  "date_format": "MM-DD-YYYY",
  "table": {
    "name": "Pages",
    "original": {
      table_id: "biy2j7bme",
      app_id: "biy2ikx6n",
      cre_date: 1398827549677,
      mod_date: 1440184904503,
      next_record_id: 172,
      next_field_id: 41,
      next_query_id: 7,
      def_sort_fid: 25,
      "def_sort_order": 1
    },
    "variables": {
      "varName": "varValue",
      ...
    },
    "chdbids": [
      {
        "name": "_dbid_doug_s_api_created_sample",
        "dbid": "bdb5rjd6g"
      },
      ...
    ],
    "queries": [
      {
        "id": 1,
        "qyname": "List All",
        "qytype": "table",
        "qycalst": "0.0",
        ...
      },
      ...
    ],
    "fields": [
      {
        "id": 6,
        "field_type": "text",
        "base_type": "text"
        "label": "Additional Information",
        ...
      },
      ...
    ]
  }
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID

API_GetUserInfo

quickbase.api('API_GetUserInfo').then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GetUserInfo').then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GetUserInfo');

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_GetUserInfo",
  "errcode": 0,
  "errtext": "No error",
  "user": {
    "id": "112149.bhsv",
    "firstName": "Ragnar",
    "lastName": "Lodbrok",
    "login": "Ragnar",
    "email": "Ragnar-Lodbrok@paris.net",
    "screenName": "Ragnar",
    "externalAuth": 0,
    "isVerified": 1
  }
}

Quick Base Documentation

Parameter Required Default Description
email false current user

API_GetUserRole

quickbase.api('API_GetUserRole', {
  dbid: 'bguin9b8e',
  userid: '112245.efy7',
  inclgrps: 1
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GetUserRole', {
  dbid: 'bguin9b8e',
  userid: '112245.efy7',
  inclgrps: 1
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GetUserRole', array(
    'dbid' => 'bguin9b8e',
    'userid' => '112245.efy7',
    'inclgrps' => 1
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_GetUserRole",
  "errcode": 0,
  "errtext": "No error",
  "user": {
    "id": "112245.efy7",
    "name": "John Doe",
    "roles": [
      {
        "id": 11,
        "name": "Participant",
        "access": {
          "id": 3,
          "name": "Basic Access"
        },
        "member": {
          "type": "user",
          "name": "John Doe'
        }
      },
      ...
    ]
  }
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
userid false current user
inclgrps false

API_GetUsersInGroup

quickbase.api('API_GetUsersInGroup', {
  gid: '2345.skdj',
  includeAllMgrs: false
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GetUsersInGroup', {
  gid: '2345.skdj',
  includeAllMgrs: false
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GetUsersInGroup', array(
    'gid' => '2345.skdj',
    'includeAllMgrs' => false
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_GetUsersInGroup",
  "errcode": 0,
  "errtext": "No error",
  "group": {
    "id": "2345.sdfk",
    "name": "GroupInfoTestGroup",
    "description": "My Group description",
    "users": [
      {
        "id": "112149.bhsv",
        "firstName": "john",
        "lastName": "doe",
        "email": "jdoe.qb@gmail.com",
        "screenName": ",
        "isAdmin": "false"
      },
      ...
    ],
    "managers": [
      {
        "id": "52731770.b82h",
        "firstName": "Angela",
        "lastName": "Leon",
        "email": "angela_leon@aleon.com",
        "screenName": "aqleon",
        "isMember": "true"
      },
      ...
    ],
    "subgroups": [
      { "id": "3450.aefs" }
      ...
    ]
  }
}

Quick Base Documentation

Parameter Required Default Description
gid true
includeAllMgrs false false

API_GrantedDBs

quickbase.api('API_GrantedDBs', {
  adminOnly: false,
  excludeparents: false,
  includeancestors: false,
  withembeddedtables: false,
  realmAppsOnly: false
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GrantedDBs', {
  adminOnly: false,
  excludeparents: false,
  includeancestors: false,
  withembeddedtables: false,
  realmAppsOnly: false
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GrantedDBs', array(
    'adminOnly' => false,
    'excludeparents' => false,
    'includeancestors' => false,
    'withembeddedtables' => false,
    'realmAppsOnly' => false
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_GrantedDBs",
  "errcode": 0,
  "errtext": "No error",
  "databases": [
    {
      "dbname": "Projects",
      "dbid": "bhgnyxp3v"
    },
    ...
  ]
}

Quick Base Documentation

Parameter Required Default Description
adminOnly false false
excludeparents false false
includeancestors false false
withembeddedtables false true
realmAppsOnly false false

API_GrantedDBsForGroup

quickbase.api('API_GrantedDBsForGroup', {
  gid: '1217.dgpt'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GrantedDBsForGroup', {
  gid: '1217.dgpt'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GrantedDBsForGroup', array(
    'gid' => '1217.dgpt'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_GrantedDBsForGroup",
  "errcode": 0,
  "errtext": "No error",
  "databases": [
    {
      "dbname": "Projects",
      "dbid": "bhgnyxp3v"
    },
    ...
  ]
}

Quick Base Documentation

Parameter Required Default Description
gid true

API_GrantedGroups

quickbase.api('API_GrantedGroups', {
  userid: '930245.jlpw',
  adminonly: false
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_GrantedGroups', {
  userid: '930245.jlpw',
  adminonly: false
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_GrantedGroups', array(
    'userid' => '930245.jlpw',
    'adminonly' => false
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_GrantedGroups",
  "errcode": 0,
  "errtext": "No error",
  "groups": [
    {
      "id": "1217.dgpt",
      "name": "GroupInfoTestGroup",
      "description": "Demo Test Group",
      "managedByUser": false
    },
    ...
  ]
}

Quick Base Documentation

Parameter Required Default Description
userid true
adminonly false false

API_ImportFromCSV

quickbase.api('API_ImportFromCSV', {
  dbid: 'bguin9b8e',
  records_csv: [
    '"First Name","Last Name","Company","Phone","Cell Phone","Zip"',
    '"Bruce","Anderson","Reyes Inc","(474) 555-0514","(390) 555-8927",<-80145>',
    '"Judy","Atwell","Conner Supplies","(499) 555-1072","(763) 555-1325",<-50737>',
    '"Kris","Babs,"Willis Orchards","(428) 555-6791","(481) 555-1335",<-81504>',
  ],
  clist: '7.8.6.5.4',
  clist_output: '',
  skipfirst: false,
  msInUTC: true
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_ImportFromCSV', {
  dbid: 'bguin9b8e',
  records_csv: [
    '"First Name","Last Name","Company","Phone","Cell Phone","Zip"',
    '"Bruce","Anderson","Reyes Inc","(474) 555-0514","(390) 555-8927",<-80145>',
    '"Judy","Atwell","Conner Supplies","(499) 555-1072","(763) 555-1325",<-50737>',
    '"Kris","Babs,"Willis Orchards","(428) 555-6791","(481) 555-1335",<-81504>',
  ],
  clist: '7.8.6.5.4',
  clist_output: '',
  skipfirst: false,
  msInUTC: true
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_ImportFromCSV', array(
    'dbid' => 'bguin9b8e',
    'records_csv' => implode("\n", array(
      '"First Name","Last Name","Company","Phone","Cell Phone","Zip"',
      '"Bruce","Anderson","Reyes Inc","(474) 555-0514","(390) 555-8927",<-80145>',
      '"Judy","Atwell","Conner Supplies","(499) 555-1072","(763) 555-1325",<-50737>',
      '"Kris","Babs,"Willis Orchards","(428) 555-6791","(481) 555-1335",<-81504>',
    )),
    'clist' => '7.8.6.5.4',
    'clist_output' => '',
    'skipfirst' => false,
    'msInUTC' => true
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_ImportFromCSV",
  "errcode": 0,
  "errtext": "No error",
  "num_recs_input": 8,
  "num_recs_added": 4,
  "rids": [
    { // Edit Record
      "update_id": 1057961999003,
      "rid": 1
    },
    { // Add Record
      "rid": 2
    },
    ...
  ]
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
records_csv true
clist true
clist_output false
decimalPercent false false
skipfirst false false
msInUTC false global instance setting
mergeFieldId false

API_ProvisionUser

quickbase.api('API_ProvisionUser', {
  dbid: 'bguin9b8e',
  email: 'sanskor@sbcglobal.com',
  roleid: 11,
  fname: 'Margi',
  lname: 'Rita'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_ProvisionUser', {
  dbid: 'bguin9b8e',
  email: 'sanskor@sbcglobal.com',
  roleid: 11,
  fname: 'Margi',
  lname: 'Rita'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_ProvisionUser', array(
    'dbid' => 'bguin9b8e',
    'email' => 'sanskor@sbcglobal.com',
    'roleid' => 11,
    'fname' => 'Margi',
    'lname' => 'Rita' 
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_ProvisionUser",
  "errcode": 0,
  "errtext": "No error",
  "userid": "112248.5nzg"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
email true
roleid false none
fname true
lname true

API_PurgeRecords

quickbase.api('API_PurgeRecords', {
  dbid: 'bguin9b8e',
  query: ''
  /* qid: 1 */
  /* qname: 'List All' */
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_PurgeRecords', {
  dbid: 'bguin9b8e',
  query: ''
  /* qid: 1 */
  /* qname: 'List All' */
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_PurgeRecords', array(
    'dbid' => 'bguin9b8e',
    'query' => ''
    /* 'qid' => 1 */
    /* 'qname' => 'List All' */
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_PurgeRecords",
  "errcode": 0,
  "errtext": "No error",
  "num_records_deleted": 21
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
query or qid or qname false all

API_RemoveGroupFromRole

quickbase.api('API_RemoveGroupFromRole', {
  dbid: 'bguin9b8e',
  gid: '345889.sjkl',
  roleid: 12,
  allRoles: false
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_RemoveGroupFromRole', {
  dbid: 'bguin9b8e',
  gid: '345889.sjkl',
  roleid: 12,
  allRoles: false
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_RemoveGroupFromRole', array(
    'dbid' => 'bguin9b8e',
    'gid' => '345889.sjkl',
    'roleid' => 12,
    'allRoles' => false
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_RemoveGroupFromRole",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
gid true
roleid true
allRoles false false

API_RemoveSubgroup

quickbase.api('API_RemoveSubgroup', {
  dbid: 'bguin9b8e',
  gid: '345889.sjkl',
  subgroupid: '345889.skld'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_RemoveSubgroup', {
  dbid: 'bguin9b8e',
  gid: '345889.sjkl',
  subgroupid: '345889.skld'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_RemoveSubgroup', array(
    'dbid' => 'bguin9b8e',
    'gid' => '345889.sjkl',
    'subgroupid' => '345889.skld'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_RemoveSubgroup",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
gid true
subgroupid true

API_RemoveUserFromGroup

quickbase.api('API_RemoveUserFromGroup', {
  dbid: 'bguin9b8e',
  gid: '345889.sjkl',
  uid: '9380434.rtgf'
  // email: 'bob@smith.com'
  // screenName: 'bob'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_RemoveUserFromGroup', {
  dbid: 'bguin9b8e',
  gid: '345889.sjkl',
  uid: '9380434.rtgf'
  // email: 'bob@smith.com'
  // screenName: 'bob'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_RemoveUserFromGroup', array(
    'dbid' => 'bguin9b8e',
    'gid' => '345889.sjkl',
    'uid' => '9380434.rtgf'
    // 'email' => 'bob@smith.com'
    // 'screenName' => 'bob'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_RemoveUserFromGroup",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
gid true
uid true
email false
screenName false

API_RemoveUserFromRole

quickbase.api('API_RemoveUserFromRole', {
  dbid: 'bguin9b8e',
  userid: '112245.efy7',
  roleid: 11
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_RemoveUserFromRole', {
  dbid: 'bguin9b8e',
  userid: '112245.efy7',
  roleid: 11
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_RemoveUserFromRole', array(
    'dbid' => 'bguin9b8e',
    'userid' => '112245.efy7',
    'roleid' => 11
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_RemoveUserFromRole",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
userid true
roleid true

API_RenameApp

quickbase.api('API_RenameApp', {
  dbid: 'bguin9b8e',
  newappname: 'Refueler'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_RenameApp', {
  dbid: 'bguin9b8e',
  newappname: 'Refueler'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_RenameApp', array(
    'dbid' => 'bguin9b8e',
    'newappname' => 'Refueler'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_RenameApp",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
newappname true

API_RunImport

quickbase.api('API_RunImport', {
  dbid: 'bguin9b8e',
  id: 10
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_RunImport', {
  dbid: 'bguin9b8e',
  id: 10
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_RunImport', array(
    'dbid' => 'bguin9b8e',
    'id' => 10
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_RunImport",
  "errcode": 0,
  "errtext": "No error",
  "import_status": "3 new records were created."
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
id true

API_SendInvitation

quickbase.api('API_SendInvitation', {
  dbid: 'bguin9b8e',
  userid: '112249.ctdg',
  usertext: 'Welcome!'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_SendInvitation', {
  dbid: 'bguin9b8e',
  userid: '112249.ctdg',
  usertext: 'Welcome!'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_SendInvitation', array(
    'dbid' => 'bguin9b8e',
    'userid' => '112249.ctdg',
    'usertext' => 'Welcome!'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_SendInvitation",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
userid true
usertext false

API_SetDBVar

quickbase.api('API_SetDBVar', {
  dbid: 'bguin9b8e',
  varname: 'usercode',
  value: 14
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_SetDBVar', {
  dbid: 'bguin9b8e',
  varname: 'usercode',
  value: 14
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_SetDBVar', array(
    'dbid' => 'bguin9b8e',
    'varname' => 'usercode',
    'value' => 14
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_SetDBVar",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID
varname true
value true

API_SetFieldProperties

quickbase.api('API_SetFieldProperties', {
  dbid: 'bguin9b8e',
  fid: 6,
  default_value: 'Hello World!'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_SetFieldProperties', {
  dbid: 'bguin9b8e',
  fid: 6,
  default_value: 'Hello World!'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_SetFieldProperties', array(
    'dbid' => 'bguin9b8e',
    'fid' => 6,
    'default_value' => 'Hello World!'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_SetFieldProperties",
  "errcode": 0,
  "errtext": "No error",
  "fid": 6,
  "name": "Business Phone Number"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
fid true
property_name true

API_SetKeyField

quickbase.api('API_SetKeyField', {
  dbid: 'bguin9b8e',
  fid: 6
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_SetKeyField', {
  dbid: 'bguin9b8e',
  fid: 6
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_SetKeyField', array(
    'dbid' => 'bguin9b8e',
    'fid' => 6
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_SetKeyField",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
fid true

API_SignOut

quickbase.api('API_SignOut').then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_SignOut').then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_SignOut');

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_SignOut",
  "errcode": 0,
  "errtext": "No error"
}

Quick Base Documentation

API_UploadFile

quickbase.api('API_UploadFile', {
  dbid: 'bguin9b8e',
  rid: 12,
  fields: [{
    fid: 18,
    filename: 'photo1.jpg',
    value: 'base64'
  }]
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_UploadFile', {
  dbid: 'bguin9b8e',
  rid: 12,
  fields: [{
    fid: 18,
    filename: 'photo1.jpg',
    value: 'base64'
  }]
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_UploadFile', array(
    'dbid' => 'bguin9b8e',
    'rid' => 12,
    'fields' => array(
      array(
        'fid' => 18,
        'filename' => 'photo1.jpg',
        'value' => 'base64'
      )
    )
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_UploadFile",
  "errcode": 0,
  "errtext": "No error",
  "file_fields": [
    "field": [
      {
        "id": 13,
        "url": "https://target_domain/up/bc4gzy4nx/g/rc/ep/va/qchain.log"
      }
    ]
  ]
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
rid true
fields true

API_UserRoles

quickbase.api('API_UserRoles', {
  dbid: 'bddnn3uz9'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_UserRoles', {
  dbid: 'bddnn3uz9'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_UserRoles', array(
    'dbid' => 'bddnn3uz9'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_UserRoles",
  "errcode": 0,
  "errtext": "No error",
  "users": [
    {
      "type": "user",
      "id": "112149.bhsv",
      "name": "Jack Danielsson",
      "lastAccess": 1403035235243,
      "lastAccessAppLocal": "06-17-2014 01:00 PM",
      "firstName": "Jack",
      "lastName": "Danielsson",
      "roles": [
        {
          "id": 12,
          "name": "Administrator",
          "access": {
            "id": 1,
            "name": "Administrator"
          }
        }
      ]
    }
  ]
}

Quick Base Documentation

Parameter Required Default Description
dbid true Application DBID

API_Webhooks_Activate

quickbase.api('API_Webhooks_Activate', {
  dbid: 'bddnn3uz9',
  actionIDList: '3,4,5'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_Webhooks_Activate', {
  dbid: 'bddnn3uz9',
  actionIDList: '3,4,5'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_Webhooks_Activate', array(
    'dbid' => 'bddnn3uz9',
    'actionIDList' => '3,4,5'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_Webhooks_Activate",
  "errcode": 0,
  "errtext": "No error",
  "numChanged": 3
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
actionIDList true

API_Webhooks_Copy

quickbase.api('API_Webhooks_Copy', {
  dbid: 'bddnn3uz9',
  actionID: 3
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_Webhooks_Copy', {
  dbid: 'bddnn3uz9',
  actionID: 3
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_Webhooks_Copy', array(
    'dbid' => 'bddnn3uz9',
    'actionID' => 3
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_Webhooks_Copy",
  "errcode": 0,
  "errtext": "No error",
  "actionID": 7,
  "success": true
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
actionID true

API_Webhooks_Create

quickbase.api('API_Webhooks_Create', {
  dbid: 'bddnn3uz9',
  label: 'Some New Webhook',
  webhookURL: 'https://some.vendor/service'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_Webhooks_Create', {
  dbid: 'bddnn3uz9',
  label: 'Some New Webhook',
  webhookURL: 'https://some.vendor/service'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_Webhooks_Create', array(
    'dbid' => 'bddnn3uz9',
    'label' => 'Some New Webhook',
    'webhookURL' => 'https://some.vendor/service'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_Webhooks_Create",
  "errcode": 0,
  "errtext": "No error",
  "success": true,
  "changed": true
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
label true
description false
query false
workflowWhen false a
webhookURL true
webhookHeader false
webhookHeaderCount false
webhookHeaderKey(n) false
webhookHeaderValue(n) false
webhookMessage false
webhookMessageFormat false XML
webhookHTTPVerb false POST
tfidsWhich false

API_Webhooks_Delete

quickbase.api('API_Webhooks_Delete', {
  dbid: 'bddnn3uz9',
  actionIDList: '3,4,5'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_Webhooks_Delete', {
  dbid: 'bddnn3uz9',
  actionIDList: '3,4,5'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_Webhooks_Delete', array(
    'dbid' => 'bddnn3uz9',
    'actionIDList' => '3,4,5'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_Webhooks_Delete",
  "errcode": 0,
  "errtext": "No error",
  "numChanged": 3
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
actionIDList true

API_Webhooks_Deactivate

quickbase.api('API_Webhooks_Deactivate', {
  dbid: 'bddnn3uz9',
  actionIDList: '3,4,5'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_Webhooks_Deactivate', {
  dbid: 'bddnn3uz9',
  actionIDList: '3,4,5'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_Webhooks_Deactivate', array(
    'dbid' => 'bddnn3uz9',
    'actionIDList' => '3,4,5'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_Webhooks_Deactivate",
  "errcode": 0,
  "errtext": "No error",
  "numChanged": 3,
  "success": true
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
actionIDList true

API_Webhooks_Edit

quickbase.api('API_Webhooks_Edit', {
  dbid: 'bddnn3uz9',
  actionID: 6,
  label: 'Some Existing Webhook to be Modified',
  webhookURL: 'https://some.vendor/service'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
quickbase.api('API_Webhooks_Edit', {
  dbid: 'bddnn3uz9',
  actionID: 6,
  label: 'Some Existing Webhook to be Modified',
  webhookURL: 'https://some.vendor/service'
}).then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
<?php

try {
  $results = $quickbase->api('API_Webhooks_Edit', array(
    'dbid' => 'bddnn3uz9',
    'actionID' => 6,
    'label' => 'Some Existing Webhook to be Modified',
    'webhookURL' => 'https://some.vendor/service'
  ));

  // Handle results
}catch(\Exception $error){
  // Handle error
}

?>

The above returns JSON structured like this:

{
  "action": "API_Webhooks_Edit",
  "errcode": 0,
  "errtext": "No error",
  "changed": true,
  "success": true
}

Quick Base Documentation

Parameter Required Default Description
dbid true Table DBID
actionID true
label true
description false
query false
workflowWhen false a
webhookURL true
webhookHeader false
webhookHeaderCount false
webhookHeaderKey(n) false
webhookHeaderValue(n) false
webhookMessage false
webhookMessageFormat false XML
webhookHTTPVerb false POST
tfidsWhich false

QBField

This abstraction class represents a singluar Quick Base field. Providing easy to use setters/getters and saving capabilities, this class aims to provide seamless integration between your code and Quick Base at the field level.

This class is utilized in the abstraction layer QBRecord and QBTable, and itself utilizes the QuickBase class.

Installation & Loading

// $ npm install --save qb-field

const QBField = require('qb-field');
// <script type="text/javascript" src="QBField.browserify.min.js"></script>

Installing the QBField library for your desired platform requires either including the browserified version of the library in your HTML page or installing it via a package manager (npm or composer).

Including the library for use in your code depends on your platform.

Initialization

const quickbase = new QuickBase({
  realm: 'subdomain/realm',
  userToken: 'user token',
  appToken: 'application token',
  flags: {
    msInUTC: true,
    encoding: 'ISO-8859-1'
  },
  connectionLimit: 10,
  errorOnConnectionLimit: false
});

const field = new QBField({
  /*
  quickbase: {
    realm: 'subdomain/realm',
    userToken: 'user token',
    appToken: 'application token',
    flags: {
      msInUTC: true,
      encoding: 'ISO-8859-1'
    },
    connectionLimit: 10,
    errorOnConnectionLimit: false
  },
  */
  quickbase: quickbase,
  dbid: 'bddnn3uz9'

  // If this is an existing field, then set the field id accordingly
  fid: 6
});
var quickbase = new QuickBase({
  realm: 'subdomain/realm',
  userToken: 'user token',
  appToken: 'application token',
  flags: {
    msInUTC: true,
    encoding: 'ISO-8859-1'
  },
  connectionLimit: 10,
  errorOnConnectionLimit: false
});


var field = new QBField({
  /*
  quickbase: {
    realm: 'subdomain/realm',
    userToken: 'user token',
    appToken: 'application token',
    flags: {
      msInUTC: true,
      encoding: 'ISO-8859-1'
    },
    connectionLimit: 10,
    errorOnConnectionLimit: false
  },
  */
  quickbase: quickbase,
  dbid: 'bddnn3uz9'

  // If this is an existing field, then set the field id accordingly
  fid: 6
});
Parameter Required Default Description
quickbase true You can either pass in an existing QuickBase instance (preferred) or create a new QuickBase instance by passing in a configuration object
dbid true Table DBID
fid false -1 Field ID

Instance Methods

clear()

field.clear();
field.clear();

This method clears the QBField instance of any trace of the existing field, but preserves defined connection settings.

delete()

field.delete().then(() => {
  // Handle success
}).catch((error) => {
  // Handle error
});
field.delete().then(function(){
  // Handle success
}).catch(function(error){
  // Handle error
});

This method deletes the field from QuickBase, then calls .clear().

get(attribute)

const label = field.get('label');
const fieldType = field.get('field_type');
var label = field.get('label');
var fieldType = field.get('field_type');
Parameter Required Default Description
attribute true Attribute name

Returns the specified attribute

getDBID()

const dbid = field.getDBID();
var dbid = field.getDBID();

As alias for .get('dbid').

This method returns the DBID.

getFid()

const fid = field.getFid();
var fid = field.getFid();

As alias for .get('fid').

This method returns the Field ID.

load()

field.load().then(() => {
  // Handle success
}).catch((error) => {
  // Handle error
});
field.load().then(function(){
  // Handle success
}).catch(function(error){
  // Handle error
});

This method executes an API_GetFieldProperties for the stored Field ID attributes.

save([attributesToSave])

field.save().then(() => {
  // Handle success
}).catch((error) => {
  // Handle error
});
field.save().then(function(){
  // Handle success
}).catch(function(error){
  // Handle error
});
Parameter Required Default Description
attributesToSave false An array of attributes you'd like to save

If a field id is not defined, this will execute an API_AddField. After a successful API_AddField, or if a field id was previously defined, this will execute an API_EditFieldProperties. If choices are defined for the field, then appropriate API_FieldAddChoices and API_FieldRemoveChoices are executed.

If attributesToSave is defined, then only configured attributes in this array will be saved.

If this executes an API_AddField, the newly assigned Field ID is automatically stored internally.

set(attribute, value)

field.set('label', 'Custom Name');
field.set('label', 'Custom Name');
Parameter Required Default Description
attribute true Attribute name
value true Attribute value

This method sets the passed in value associated with the attribute argument.

setDBID(dbid)

field.setDBID('bddnn3uz9');
field.setDBID('bddnn3uz9');
Parameter Required Default Description
dbid true DBID of table

Alias for .set('dbid', 'bddnn3uz9').

Sets the dbid setting.

setFid(fid)

field.setFid(6);
field.setFid(6);
Parameter Required Default Description
fid true Field ID

Sets the fid setting.

toJson([attributesToConvert])

const json = field.toJson();
var json = field.toJson();
Parameter Required Default Description
attributesToConvert false attributes you'd like to convert to json

Returns the field as a JSON object

Static Methods

.FormatValue(field, value)

Parameter Required Default Description

.NewField(options, attributes)

Parameter Required Default Description
options true Field constructor options
attributes true Field attributes

.ParseValue(field, value)

Parameter Required Default Description

QBRecord

This abstraction class represents a singluar Quick Base record. Providing easy to use setters/getters and saving capabilities, this class aims to provide seamless integration between your code and Quick Base at the record level.

This class is utilized in the abstraction layer QBTable and itself utilizies the QuickBase class.

Installation & Loading

// $ npm install --save qb-record

const QBRecord = require('qb-record');
// <script type="text/javascript" src="QBRecord.browserify.min.js"></script>

Installing the QBRecord library for your desired platform requires either including the browserified version of the library in your HTML page or installing it via a package manager (npm or composer).

Including the library for use in your code depends on your platform.

Initialization

const quickbase = new QuickBase({
  realm: 'subdomain/realm',
  userToken: 'user token',
  appToken: 'application token',
  flags: {
    msInUTC: true,
    encoding: 'ISO-8859-1'
  },
  connectionLimit: 10,
  errorOnConnectionLimit: false
});

const record = new QBRecord({
  /*
  quickbase: {
    realm: 'subdomain/realm',
    userToken: 'user token',
    appToken: 'application token',
    flags: {
      msInUTC: true,
      encoding: 'ISO-8859-1'
    },
    connectionLimit: 10,
    errorOnConnectionLimit: false
  },
  */
  quickbase: quickbase,
  dbid: 'bddnn3uz9',
  fids: {
    recordid: 3,
    primaryKey: 3
  },

  // If this is an existing record, then set the record id and primary key accordingly
  recordid: 12,
  primaryKey: 12
});
var quickbase = new QuickBase({
  realm: 'subdomain/realm',
  userToken: 'user token',
  appToken: 'application token',
  flags: {
    msInUTC: true,
    encoding: 'ISO-8859-1'
  },
  connectionLimit: 10,
  errorOnConnectionLimit: false
});


var record = new QBRecord({
  /*
  quickbase: {
    realm: 'subdomain/realm',
    userToken: 'user token',
    appToken: 'application token',
    flags: {
      msInUTC: true,
      encoding: 'ISO-8859-1'
    },
    connectionLimit: 10,
    errorOnConnectionLimit: false
  },
  */
  quickbase: quickbase,
  dbid: 'bddnn3uz9',
  fids: {
    recordid: 3,
    primaryKey: 3
  },

  // If this is an existing record, then set the record id and primary key accordingly
  recordid: 12,
  primaryKey: 12
});
Parameter Required Default Description
quickbase true You can either pass in an existing QuickBase instance (preferred) or create a new QuickBase instance by passing in a configuration object
dbid true Table DBID
fids false Object containing name/value pairs of fields and their field ids
recordid false If constructing a pre-existing record, you can define the record id at initialization
primaryKey false If constructing a pre-existing record, you can define the primary key at initialization

Instance Methods

.clear()

record.setFid('firstName', 6);
record.set('firstName', 'Bob');

console.log(record.getFid('firstName')); // 6
console.log(record.get('firstName')); // Bob

record.clear();

console.log(record.getFid('firstName')); // 6
console.log(record.get('firstName')); // undefined
record.setFid('firstName', 6);
record.set('firstName', 'Bob');

console.log(record.getFid('firstName')); // 6
console.log(record.get('firstName')); // Bob

record.clear();

console.log(record.getFid('firstName')); // 6
console.log(record.get('firstName')); // undefined

This method clears the QBRecord instance of any trace of the existing record, but preserves defined settings

.delete()

record.set('recordid', 6);

return record.delete().then(() => {
  // Record 6 deleted
}).catch((error) => {
  // Handle error
});
record.set('recordid', 6);

record.delete().then(function(){
  // Record 6 deleted
}).catch(function(error){
  // Handle error
});

This method deletes the record from QuickBase, then calls .clear().

.get(name)

record.set('firstName', 'Bob');

const firstName = record.get('firstName');

console.log(firstName); // Bob
record.set('firstName', 'Bob');

var firstName = record.get('firstName');

console.log(firstName); // Bob

This method returns the stored value associated with the name argument, defined in the fids object in the inialization of the instance or defined with .setFid().

Parameter Required Default Description
name true A string presenting a fids name/value pairs name value

.getDBID()

record.setDBID('bddnn3uz9');

const dbid = record.getDBID();

console.log(dbid); // bddnn3uz9
record.setDBID('bddnn3uz9');

var dbid = record.getDBID();

console.log(dbid); // bddnn3uz9

This method returns the stored DBID.

.getFid(field[, byId])

record.setFid('firstName', 6);

const fid = record.getFid('firstName');
const fidName = record.getFid(fid, true);

console.log(fid, fidName); // 6, firstName
record.setFid('firstName', 6);

var fid = record.getFid('firstName');
var fidName = record.getFid(fid, true);

console.log(fid, fidName); // 6, firstName

Returns either the field id or field name depending on byId

Parameter Required Default Description
field true The name of the field you wish to get the feild id of
byId false false If set to true then field is assumed to be the field id and returns to field name

.getFids()

record.setFid('firstName', 6);
record.setFid('lastName', 7);

const fids = record.getFids();

console.log(fids); // { firstName: 6, lastName: 7 }
record.setFid('firstName', 6);
record.setFid('lastName', 7);

var fids = record.getFids();

console.log(fids); // { firstName: 6, lastName: 7 }

Returns the entire fids object

.getField(id)

record.set('recordid', 3);
record.setFid('firstName', 6);

record.load().then(() => {
  const field = record.getField(record.getFid('firstName'));

  console.log(field); // { label: 'First Name', fid: 6, ... }
}).catch((error) => {
  // Handle error
});
record.setFid('firstName', 6);

record.loadSchema().then(function(){
  const field = record.getField(record.getFid('firstName'));

  console.log(field); // { label: 'First Name', fid: 6, ... }
}).catch(function(error){
  // Handle error
});

Returns field schema object

Parameter Required Default Description
id true Field id of the field you want returned

.getFields()

record.setFid('firstName', 6);
record.setFid('lastName', 7);

record.loadSchema().then(() => {
  const fields = record.getFields();

  console.log(fields); // [{ label: 'First Name', fid: 6, ... }, { label: 'Last Name', fid: 7, ... }]
}).catch((error) => {
  // Handle error
});
record.setFid('firstName', 6);
record.setFid('lastName', 7);

record.loadSchema().then(function(){
  const fields = record.getFields();

  console.log(fields); // [{ label: 'First Name', fid: 6, ... }, { label: 'Last Name', fid: 7, ... }]
}).catch(function(error){
  // Handle error
});

Returns an array of all loaded field schema objects

.getTableName()

record.loadSchema().then(() => {
  const tableName = record.getTableName();

  console.log(tableName); // Customers
}).catch((error) => {
  // Handle error
});
record.loadSchema().then(function(){
  const tableName = record.getTableName();

  console.log(tableName); // Customers
}).catch(function(error){
  // Handle error
});

Returns the name of the Quick Base table.

.load([localQuery[, localClist]])

record.set('recordid', 3);

record.load().then(() => {
  console.log(record.toJson()); // { recordid: 3, firstName: ... }
}).catch((error) => {
  // Handle error
});
record.set('recordid', 3);

record.load().then(function(){
  console.log(record.toJson()); // { recordid: 3, firstName: ... }
}).catch(function(error){
  // Handle error
});

Loads the defined record from Quick Base, executing a structured DoQuery to retrieve and populate internal schema and data structures

Parameter Required Default Description
localQuery false A string or object

If a string is passed in, it is treated as a query string. If an object is passed in, subsequent arguments will be ignored, assuming they've been passed in via this object.
localClist false A period delimited string of field ids or an array of field ids

.loadSchema()

record.loadSchema().then(() => {
  console.log(record.getFields());
}).catch((error) => {
  // Handle error
});
record.loadSchema().then(function(){
  console.log(record.getFields());
}).catch(function(error){
  // Handle error
});

Executes an API_GetSchema and stores the returned results internally.

.save([fidsToSave])

record.set('firstName', 'Bob');
record.set('lastName', 'Smith');

record.save().then(() => {
  console.log(record.get('recordid')); // 6
}).catch((error) => {
  // Handle error
});

// Explicity saving a list of fields
record.set('firstName', 'Bob');
record.set('lastName', 'Smith');
record.set('age', 24);

record.save([
  'firstName',
  'lastName'
]).then(() => {
  console.log(record.get('recordid')); // 6
}).catch((error) => {
  // Handle error
});
record.set('firstName', 'Bob');
record.set('lastName', 'Smith');

]).then(function(){
  console.log(record.get('recordid')); // 6
}).catch(function(error){
  // Handle error
});

// Explicity saving a list of fields
record.set('firstName', 'Bob');
record.set('lastName', 'Smith');
record.set('age', 24);

record.save([
  'firstName',
  'lastName'
]).then(function(){
  console.log(record.get('recordid')); // 6
}).catch(function(error){
  // Handle error
});

This method executes either an API_AddRecord or an API_EditRecord depending on the set Record ID. If a Record ID is stored, then it executes an API_EditRecord otherwise, an API_AddRecord.

If fidsToSave is defined, then only configured fids in this array will be saved.

If this executes an API_AddRecord, the newly assigned Record ID is automatically stored internally. If the defined primaryKey FID is also a defined field in the fids object, then this is also automatically stored internally.

Parameter Required Default Description
fidsToSave false An array of inclusive fields to save, if omitted, all defined fields will be saved

.set(field, value)

record.set('firstName', 'Bob');

console.log(record.get('firstName')); // Bob
record.set('firstName', 'Bob');

console.log(record.get('firstName')); // Bob

This method sets the passed in value associated with the name argument, defined in the fids object in the inialization of the instance.

Parameter Required Default Description
field true Field name to set the value of
value true Value of the field to set

.setDBID(dbid)

record.setDBID('bddnn3uz9');

const dbid = record.getDBID();

console.log(dbid); // bddnn3uz9
record.setDBID('bddnn3uz9');

const dbid = record.getDBID();

console.log(dbid); // bddnn3uz9

Sets the dbid setting.

Parameter Required Default Description
dbid true DBID to set

.setFid(name, id)

record.setFid('firstName', 6);

console.log(record.getFid('firstName')); // 6
record.setFid('firstName', 6);

console.log(record.getFid('firstName')); // 6

Adds/Updates configured field with the name of name and the field id of id.

Parameter Required Default Description
name true Name of the field configuration you're defining
id true Field id of the field configuration you're defining

.setFids(fields)

record.setFids([{
  name: 'firstName',
  fid: 6
}, {
  name: 'lastName',
  fid: 7
});

console.log(record.getFids()); // { firstName: 6, lastName: 7 }
record.setFids([{
  name: 'firstName',
  fid: 6
}, {
  name: 'lastName',
  fid: 7
});

console.log(record.getFids()); // { firstName: 6, lastName: 7 }
Parameter Required Default Description
fields true An array of objects containing a name and fid attribute that will mapped over and passed to .setFid()

.toJson([fidsToConvert])

project.set('projectName', 'Some Example Project');
project.set('completed', false);
project.set('finishDate', moment(1587355200000));
project.set('elapsedTime', moment.duration(10800000));
project.set('$tableRow', $('.some-tr-row'));

task.set('taskName', 'Some Task');

project.set('tasks', [
  task
]);

project.toJson();
project.set('projectName', 'Some Example Project');
project.set('completed', false);
project.set('finishDate', moment(1587355200000));
project.set('elapsedTime', moment.duration(10800000));
project.set('$tableRow', $('.some-tr-row'));

task.set('taskName', 'Some Task');

project.set('tasks', [
  task
]);

project.toJson();

The above returns JSON structured like this:

{
  "projectName": "Some Example Project",
  "completed": false,
  "finishDate": "2020-04-20T04:00:00.000Z",
  "elapsedTime": 10800000,
  "$tableRow": "[DOM Object]",
  "tasks": [{
    "taskName": "Some Task"
  }]
}

Returns the record in JSON format.

Parameter Required Default Description
fidsToConvert false An array of field names to convert into the resulting JSON object

QBTable

This abstraction class represents a singluar Quick Base table and the potential to represent multiple QBRecord instances. Providing easy to use setters/getters and saving capabilities, this class aims to provide seamless integration between your code and Quick Base at the table level.

This class utilizies the QBRecord and QuickBase classes.

Installation & Loading

// $ npm install --save qb-table

const QBTable = require('qb-table');
// <script type="text/javascript" src="QBTable.browserify.min.js"></script>

Installing the QBTable library for your desired platform requires either including the browserified version of the library in your HTML page or installing it via a package manager (npm or composer).

Including the library for use in your code depends on your platform.

Initialization

const quickbase = new QuickBase({
  realm: 'subdomain/realm',
  userToken: 'user token',
  appToken: 'application token',
  flags: {
    msInUTC: true,
    encoding: 'ISO-8859-1'
  },
  connectionLimit: 10,
  errorOnConnectionLimit: false
});

const table = new QBTable({
  /*
  quickbase: {
    realm: 'subdomain/realm',
    userToken: 'user token',
    appToken: 'application token',
    flags: {
      msInUTC: true,
      encoding: 'ISO-8859-1'
    },
    connectionLimit: 10,
    errorOnConnectionLimit: false
  },
  */
  quickbase: quickbase,
  dbid: 'bddnn3uz9',
  fids: {
    recordid: 3,
    primaryKey: 3
  }
});
var quickbase = new QuickBase({
  realm: 'subdomain/realm',
  userToken: 'user token',
  appToken: 'application token',
  flags: {
    msInUTC: true,
    encoding: 'ISO-8859-1'
  },
  connectionLimit: 10,
  errorOnConnectionLimit: false
});

var table = new QBTable({
  /*
  quickbase: {
    realm: 'subdomain/realm',
    userToken: 'user token',
    appToken: 'application token',
    flags: {
      msInUTC: true,
      encoding: 'ISO-8859-1'
    },
    connectionLimit: 10,
    errorOnConnectionLimit: false
  },
  */
  quickbase: quickbase,
  dbid: 'bddnn3uz9',
  fids: {
    recordid: 3,
    primaryKey: 3
  }
});
Parameter Required Default Description
quickbase true You can either pass in an existing QuickBase instance (preferred) or create a new QuickBase instance by passing in a configuration object
dbid true Table DBID
fids false Object containing name/value pairs of fields and their field ids
query false Default query prepended to every DoQuery
slist false Default slist prepended to every DoQuery
options false Default options prepended to every DoQuery

Instance Methods

.clear()

This method clears the QBTable instance of any trace of existing data, but preserves defined settings

.deleteRecord(record)

Removes the passed in QBRecord instance from the local cache. If the QBRecord has a Record ID, then it is deleted via API_DeleteRecord

Parameter Required Default Description
record true A QBRecord instance

.deleteRecords([individually])

If individually is true, then it executes and API_DeleteRecord for each locally loaded QBRecord. If individually is false, then it executes an API_PurgeRecords for all of the locally loaded QBRecord's.

Parameter Required Default Description
individually false false If true, API_DeleteRecord is used instead of API_PurgeRecords

.getAppID()

This method returns the stored App ID.

.getDateFormat()

This method returns the stored Quick Base applications configured date format.

.getDBID()

This method returns the stored DBID.

.getChildTables()

Returns an array of objects comprising dbid and name of an applications tables

.getFid(field[, byId])

table.setFid('firstName', 6);

const fid = table.getFid('firstName');
const fidName = table.getFid(fid, true);

console.log(fid, fidName); // 6, firstName
table.setFid('firstName', 6);

var fid = table.getFid('firstName');
var fidName = table.getFid(fid, true);

console.log(fid, fidName); // 6, firstName

Returns either the field id or field name depending on byId

Parameter Required Default Description
field true The name of the field you wish to get the feild id of
byId false false If set to true then field is assumed to be the field id and returns to field name

.getFids()

table.setFid('firstName', 6);
table.setFid('lastName', 7);

const fids = table.getFids();

console.log(fids); // { firstName: 6, lastName: 7 }
table.setFid('firstName', 6);
table.setFid('lastName', 7);

var fids = table.getFids();

console.log(fids); // { firstName: 6, lastName: 7 }

Returns the entire fids object

.getField(id)

table.set('recordid', 3);
table.setFid('firstName', 6);

table.load().then(() => {
  const field = table.getField(table.getFid('firstName'));

  console.log(field); // { label: 'First Name', fid: 6, ... }
}).catch((error) => {
  // Handle error
});
table.setFid('firstName', 6);

table.loadSchema().then(function(){
  const field = table.getField(table.getFid('firstName'));

  console.log(field); // { label: 'First Name', fid: 6, ... }
}).catch(function(error){
  // Handle error
});

Returns field schema object

Parameter Required Default Description
id true Field id of the field you want returned

.getFields()

table.setFid('firstName', 6);
table.setFid('lastName', 7);

table.loadSchema().then(() => {
  const fields = table.getFields();

  console.log(fields); // [{ label: 'First Name', fid: 6, ... }, { label: 'Last Name', fid: 7, ... }]
}).catch((error) => {
  // Handle error
});
table.setFid('firstName', 6);
table.setFid('lastName', 7);

table.loadSchema().then(function(){
  const fields = table.getFields();

  console.log(fields); // [{ label: 'First Name', fid: 6, ... }, { label: 'Last Name', fid: 7, ... }]
}).catch(function(error){
  // Handle error
});

Returns an array of all loaded field schema objects

.getNRecords()

If .load() has been executed, returns the number of loaded records.

.getOptions()

Returns the configured options.

.getPlural()

Returns the Quick Base configured plural noun for the tables records

.getQueries()

Returns an array of configured Quick Base queries

.getQuery()

Returns the configured query.

.getRecord(value, fieldName[, returnIndex])

Find a specific record in the locally loaded QBRecords where fieldName is equal to value.

If returnIndex is true, then it returns the index of the internal array for that record. If returnIndex is false, then it returns the QBRecord instance.

Parameter Required Default Description
value true Value to search for
fieldName true Field name of field to search against
returnIndex false false If true, returns the index of the internal records array instead of the record itself

.getRecords()

If a .load() has been executed, return the loaded QBRecords.

.getSingular()

Returns the Quick Base configured singular noun for the tables records

.getSList()

Returns the configured slist.

.getTableName()

If .load() or .loadSchema() has been executed, returns the table name.

.getTimezone()

Returns the Quick Base applications configured time zone

.getVariable(name)

If .load() or .loadSchema() has been executed, returns defined requested variable.

Parameter Required Default Description
name true Name of the Quick Base variable

.getVariables()

If .load() or .loadSchema() has been executed, returns an array of Quick Base variables.

.load([localQuery[, localClist[, localSlist[, localOptions]]])

table.load("{'3'.GT.'1'}").then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});

table.load({
  query: "{'3'.GT.'1'}",
  options: 'sortorder-A'
}).then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
table.load("{'3'.GT.'1'}").then(function(records){
  // Handle records
}).catch(function(error){
  // Handle error
});

table.load({
  query: "{'3'.GT.'1'}",
  options: 'sortorder-A'
}).then(function(records){
  // Handle records
}).catch(function(error){
  // Handle error
});
Parameter Required Default Description
localQuery false Query string to filter on or an object of query parameters
localClist false List of Field ID's period delimited
localSlist false List of Field ID's period delimited
localOptions false List of query options period delimited

This method executes an API_DoQuery. Will automatically map all values defined in the fids or localClist object.

If localQuery is defined, it will be appended to the defined table query. If localClist is defined, this will be used instead of the defined fids. If localSlist is defined, this will be used instead of the defined slist. if localOptions is defined, this will be used instead of the defined options.

You may also pass in an object as the first parameter, which in turn can pass in the other options.

.loadNRecords([localQuery])

table.loadNRecords("{'3'.GT.'1'}").then((results) => {
  // Handle results
}).catch((error) => {
  // Handle error
});
table.loadNRecords("{'3'.GT.'1'}").then(function(results){
  // Handle results
}).catch(function(error){
  // Handle error
});
Parameter Required Default Description
localQuery false Query string to filter on or an object of query parameters

This method executes an API_DoQueryCount.

If localQuery is defined, it will be appended to the defined table query.

.loadSchema()

table.loadSchema().then((fields) => {
  // Handle fields
}).catch((error) => {
  // Handle error
});
table.loadSchema().then(function(fields){
  // Handle fields
}).catch(function(error){
  // Handle error
});

Executes an API_GetSchema and stores the returned results internally.

.save([individually[, fidsToSave]])

Parameter Required Default Description

.setDBID(dbid)

Parameter Required Default Description

.setFid(name, id)

Parameter Required Default Description

.setFids(fields)

Parameter Required Default Description

.setOptions(options)

Parameter Required Default Description

.setQuery(query)

Parameter Required Default Description

.setSList(slist)

Parameter Required Default Description

.toJson([fidsToConvert])

Parameter Required Default Description

.upsertField(options[, autoSave])

Parameter Required Default Description

.upsertFields(fields[, autoSave])

Parameter Required Default Description

.upsertRecord(options[, autoSave])

Parameter Required Default Description

.upsertRecords(records[, autoSave[, individually]])

Parameter Required Default Description

Static Methods

.NewRecord(table, record)

Parameter Required Default Description

.NewRecords(table, records)

Parameter Required Default Description

Query Tokens

These query tokens can be used in either the Quick Base query string or as a field value for API_EditRecord and API_AddRecord.

Token Query String Field Value Description
_curuser_ true true Is replaced with the user id of the user assigned to the used ticket or user token
_fid_<field id> true true Is replaced with the value of the specified field for that record (Example: _fid_3 would be the Record ID#)
today true true Used for date fields
now true true Used for date/time fields

Error Handling

When making an API call to Quick Base, Quick Base responds with at least two values, errcode, and errtext and sometimes an errdetail property.

After receiving a response, the libraries detailed automatically check and verify that the response does not contain an error. You do not have to explicity check if errcode is equal to 0.

In JavaScript, an Error is thrown and needs to be caught in a catch() along the Promise chain.

In PHP, an Exception is thrown and needs to be caught in a try/catch statement.

Practical Examples

Binding QBRecord to a <form>

var $form = $('form.exampleForm');
var $firstName = $('input[name=firstName]');
var $lastName = $('input[name=lastName]');

record.setFid('firstName', 6);
record.setFid('lastName', 7);

record.set('recordid', 6);

$firstName.on('input', function(){
    record.set('firstName', $(this).val());
});

$lastName.on('input', function(){
    record.set('lastName', $(this).val());
});

$form.on('submit', function(){
  return record.save().then(function(){
    // Record saved
  }).catch(function(error){
    // Handle error
  });;
});

record.load().then(function(){
  $firstName.val(record.get('firstName'));
  $lastName.val(record.get('lastName'));
}).catch(function(error){
  // Handle error
});

Using QBRecord, binding your data and JavaScript to the DOM is easier than ever.

Using jQuery to get access to the DOM, we can easily listen for changes to the form and immediately reflect them in our QBRecord instance.

Once the user is done, we execute the .save() method which will save any input to Quick Base.

Batch DoQuery with QBTable

const setAll = (arr, value) => {
  for(let i = 0; i < arr.length; ++i){
    arr[i] = value;
  }

  return arr;
};

const batchSize = 10000;

const query = [
  "{'" + table.getFid('recordid') + "'.XEX.'0'}"
].join('AND');

return table.loadNRecords(query).then((nRecords) => {
  return setAll(new Array(Math.ceil(nRecords / batchSize)), false);
}).reduce((records, _, i) => {
  return table.load({
    query: query,
    slist: table.getFid('recordid'),
    options: [
      'num-' + batchSize,
      'skp-' + (batchSize * i)
    ].join('.')
  }).each((record) => {
    records.push(record);
  }).then(() => {
    return records;
  });
}, []).then((records) => {
  // Handle records array
}).catch((error) => {
  // Handle error
});
const setAll = function(arr, value){
  for(let i = 0; i < arr.length; ++i){
    arr[i] = value;
  }

  return arr;
};

const batchSize = 10000;

const query = [
  "{'" + table.getFid('recordid') + "'.XEX.'0'}"
].join('AND');

return table.loadNRecords(query).then(function(nRecords){
  return setAll(new Array(Math.ceil(nRecords / batchSize)), false);
}).reduce((records, _, i) => {
  return table.load({
    query: query,
    slist: table.getFid('recordid'),
    options: [
      'num-' + batchSize,
      'skp-' + (batchSize * i)
    ].join('.')
  }).each(function(record){
    records.push(record);
  }).then(function(){
    return records;
  });
}, []).then((records) => {
  // Handle records array
}).catch(function(error){
  // Handle error
});

This example demonstrates how you would work around the Report Too Large error Quick Base returns sometimes.

If you need to batch out your DoQuery's, you first need to do a DoQueryCount and find out how many batches you are going to process.

Using the reduce method of the Bluebirdjs library, we can compile and return a single array after n DoQuery's