GetGrantedDBs returns all apps across all realms. Is it possible to get only the apps within a certain realm?

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered
Photo of Forrest


  • 0 Points

Posted 3 years ago

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

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,224 Points 20k badge 2x thumb
I like this questions as the answer is not apparent and you get to play with a new API. In fact I doubt anybody in QuickBase user land has ever used the API I am going to show you.

There is no way to manipulate parameters of the API_GetGRantedDBs to return applications within a specific realm. What you can do is loop through all the dbids returns by API_GetGRantedDBs and make a short AJAX call to determine which domain each specific dbid belongs to. It isn't obvious what AJAX call to make.

Let's say your domain is yourdomain and the dbid in question is dbid. If you make an AJAX call to

QuickBase will redirect to

if the dbid is not associated with yourdomain. In other words, QuickBase will redirect to a URL associated with the real subdomain associated with the specifid dbid.
Now it isn't that simple to determine if an AJAX request has been redirected because the relevant browser specs require that redirection happen seamlessly. Luckily, the new Fetch API has a parameter in the response which provides the final URL (ie response.url). So to determine if a URL is in a specific subdomain you
(1) loop through all dbids returns by API_GetGRantedDBs
(2) make an AJAX call to
(3) and test if response.url is the same or different than yourdomain
To lighten the load on your AJAX requests you should make a HEAD request (not a POST or GET)
fetch(url, {   method: "HEAD" }).then(function(response) {   console.log(response.url); });

Can I Use: Fetch API