Forum Discussion

RohitAgarwal's avatar
RohitAgarwal
Qrew Cadet
8 years ago

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

  • 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.
    • _anomDiebolt_'s avatar
      _anomDiebolt_
      Qrew Elite
      So where does the part about "App Token" fit into your reformulated question?
  • > 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
    • RohitAgarwal's avatar
      RohitAgarwal
      Qrew Cadet
      Thank you so much,

      One last question. 
      Is there any API to get Application ID.
      for ex- 
      I am in Application X. I write some script in order to get Application ID.
    • _anomDiebolt_'s avatar
      _anomDiebolt_
      Qrew Elite
      Just dip into one of QuickBase global variables:

      gReqAppDBID