Select a list of data from database with JS API.

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered

I need to get a SELECT * FROM a specific table in my custom page but I realized that I need to initialize a QuickBaseClient object that has a method called DoQuery, right? I saw it implemented but I do not understand how to use it. Could you please provide me an example of how to select all the records from an html using the JS api? I do also need to know how to delete, insert and update records.

Photo of Donovan

Donovan

  • 0 Points

Posted 4 years ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,044 Points 20k badge 2x thumb
> ... SELECT * FROM ...

There are no SQL features exposed to users with QuickBase.

> ... using the JS api ...

QuickBase does not have a JavaScript API - rather the API is HTTP based and is documented here:

Welcome to the QuickBase HTTP API Reference
http://www.quickbase.com/api-guide/index.html


QuickBase does have a JavaScript SDK called QuickBaseClient which provides some abstractions to calling the underlying HTTP API:

https://github.com/QuickbaseAdmirer/Quickbase-JavaScript-SDK


However, the abstractions provided by QuickBaseClient are limited. In my opinion you are better off calling the the QuickBase HTTP API directly using the abstractions provided by (1) JavaScript, (2) jQuery and (3) Underscore and any additional libraries you may want to use. JavaScript has become extremely powerful and the jQuery and Underscore libraries make working with the QuickBase  HTTP API extremely simple.

>I do also need to know how to delete, insert and update records.


The following API methods preform the primary CRUD (Create, Read, Update, Delete) operations:

Create (SQL: INSERT): API_AddRecord, API_GenAddRecordForm, API_ImportFromCSV (plural)

Read (SQL: SELECT): API_GetRecordAsHTML, API_GetRecordInfo, API_GenResultsTable (plural)

Update (SQL: UPDATE): API_EditRecord, API_ImportFromCSV (plural)

Delete (SQL: DELETE: API_DeleteRecord (single) and PAI_PurgeRecords (plural)


The QuickBase HTTP API documentation emphasizes packing up an XML body in a POST request. However, the API will accept a wide range of ways to pass parameters including using headers or a query string using either POST or GET methods. When using jQuery to make your AJAX calls with the QuickBase API you are better off not packaging up an XML body and just use pass parameters as an object and jQuery will format the request properly. Another reason to not use the QuickBaseClient is that you can make both API and non-API calls to QuickBase using the same idioms ratehr than using two different idioms.