Skip to main content
Question

Is there any API for getting App Token & DBIDS w.r.t to table name?

  • September 4, 2017
  • 0 replies
  • 51 views

Is there any API for getting App Token & DBIDS w.r.t to table name?
This topic has been closed for replies.

Application Tokens are associated with Applications not individual tables. Additionally, there can be several Application Tokens associated with an Application. Given these two observations it isn't clear what your original question is asking or what you are trying to accomplish.

In any case when you are trying to automate some task across your entire account it can be problematic using the API because there is often no common Application Token to use within your script (unless you manually set this up). In these cases you can still write the script but you have to use non-API methods. This may seem unusual if it is your first exposure to the technique but you can GET or POST to any QuickBase endopoint URL using AJAX methods.

You didn't get my question. 
API that gives me DBID w.r.t to table name means I pass table name as the parameter and I get the DBID.

> I pass table name as the parameter and I get the DBID.

Like this:

var name = "250 Bottles of Beer on the Form";

$.get("main?act=API_GrantedDBs")
  .then(function(xml) {
    var dbid = $("dbname", xml).filter(function() {
      return $(this).text() === name;
    }).next("dbid").text();
    console.log(dbid);
  })

//output
bj4vxvurn

Or this version which employs Async / Await:

(function(){
  async function getDBID(name) {
    var xml = await Promise.resolve(
      $.get("main?act=API_GrantedDBs")
    );
    var dbid = $("dbname", xml).filter(function() {
      return $(this).text() === name;
    }).next("dbid").text();
    return dbid;
  }
  var name = "250 Bottles of Beer on the Form";
  getDBID(name).then(function(dbid) {
    console.log(dbid, name)
  });
})();
//output:
//bj4vxvurn 250 Bottles of Beer on the Form