Forum Discussion

_anomDiebolt_'s avatar
_anomDiebolt_
Qrew Elite
8 years ago

Some Notes On QuickBase URLs I Had Written Up

I found these old notes I wrote up for a client while ago that some of you may benefit from.

I updated some of the info. Here goes:

Everything after the question mark (ie "?") in the URL is called the "query string".

So in this URL:

  https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=q&qid=1

the query string is "a=q&qid=1".

The query string consists of a set of parameters and values separated by an ampersand (ie "&").

In the above URL there are two parameters:

  parameter "a" with value "q"
  parameter "qid" with value "1"
  
The value of a parameter is always considered to be text even if it represents a number, date or some other type.

QuickBase calls the "a" parameter the action which is a value that usually is an abbreviated verb hinting at the primary purpose of the page: 

  "dr" for "display record"
  "er" for edit record.

Generally QuickBase uses "a=" for native actions (the GU_I) and "act=" for actions associated with the HTTP API. Although these two parameters are essentially equivalent, you may occasionally see this convention violated:

  https://haversineconsulting.quickbase.com/db/bgcwm2m4g?act=q&qid=1
  https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=API_DoQuery&qid=1

It makes no difference what order the parameters and values are specified in although the action parameter is almost always listed first:

  https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=q&qid=1
  https://haversineconsulting.quickbase.com/db/bgcwm2m4g?qid=1&a=q
  
If often does not matter if the case of a parameter is upper or low_er case:

  https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=q&qid=1
  https://haversineconsulting.quickbase.com/db/bgcwm2m4g?A=q&qid=1

If the value of the parameter is not record data (eg _fid_6=Jones), it may not matter if the value of a parameter is upper or lower case:
 
  https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=q&qid=1
  https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=Q&qid=1

Sometimes QuickBase does not use consistent capitalization for the values of the action:

  a=AppDBPages
  a=appdbpages
  
  act=API_EditRecord
  act=API_editrecord
  
Despite all these variations in the format and structure of QuickBase URLs, your hyperlinks, formula URLs and URLs used in scripts will all be easier to understand and maintain if you rigidly follow the more popular convention.

You occasionally may see a URL with a pound sign (ie "#") at the end. This part of the URL is called the "hash" or "fragment identifier". This part of the URL is not supposed to be sent to the server as it is just an identifier pointing to a specific location within the current document.

Occasionally you will see some parameters tacked onto to the end of a URL which have an unknown purpose or cryptic value such as the "rl" parameter:

https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&r=vp&;rl=jr6

In general these parameters push some additional state around to indicate some supplemental information that is incidental the the main purpose or action of the URL. In the above URL the rl parameter is communicating what report QuickBase should redirect to after the user is finished viewing the page. You can often simply delete these extra parameters without any adverse side effects when forming your own URLs.

In many URLs you will see string consisting of seemingly random characters. In the above URL there are three such strings:

  1) bgcwm2m4g
  2) vp
  3) jr6
  
These strings are all "OBE32" (One Base Encoded) encoded integers which uses a base 32 encoding scheme. You can convert between obe32 and decimal integer representation using the following JavaScript code:

function ob32decode(ob32) {
 var ob32Characters = "abcdefghijkmnpqrstuvwxyz23456789";
 var decode = 0;
 var place = 1;
 for (var counter = ob32.length -1; counter >= 0; counter--) {   
  var oneChar = ob32.charAt(counter);
  var oneDigit = ob32Characters.indexOf(oneChar);
  decode += (oneDigit * place);
  place = place*32;
 }
 return decode;
}
function ob32encode(strDecimal) {
 var ob32Characters = "abcdefghijkmnpqrstuvwxyz23456789";
 var decimal = parseInt(strDecimal);
 var ob32 = "";
 while (decimal > 0) {
  var remainder = decimal % 32;
  remainder = ob32Characters.substr(remainder,1);
  ob32 = remainder.concat(ob32);
  decimal = Math.floor(decimal/32);
 }
 return ob32;
}
console.log(ob32decode("sk")); //returns 522
console.log(ob32decode("cn")); //returns 76
console.log(ob32encode(522)); //returns "sk"
console.log(ob32encode(76));  //returns "cn"

It is a little know trivia fact that the dbid is actually an OBE32 encoded creation time of the application or table!

Record IDs, Field IDs and other IDs used by QuickBase are often represented in both OBE32 encoded values and decimal values:

https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&;r=jg
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&;rid=294

In the URL above the parameter "r" refers to the OBE32 encoded Record ID# while the parameter "rid" refers to the decimal value. For readability in writing your own formulas and scripts you are almost always better of referring to the decimal value of the parameter rather than the OBE32 encoded value.

Likewise, it is a better choice to use the named value of a parameter rather than a numeric value of a parameter:

https://haversineconsulting.quickbase.com/db/bne59biqr?a=dbpage&;pagename=sw1.js
https://haversineconsulting.quickbase.com/db/bne59biqr?a=dbpage&;pageID=4

QuickBase uses a number of URL parameters to chain the redirection of pages together in different contexts. When using the HTTP API the parameter rdr is used:

var text URLONE = ...;
var text URLTWO = ...;
$URLONE
& "&rdr=" & URLEncode($URLTWO)

The rdr parameter must be URL Encoded to prevent ampersands within the rdr's value (URLTWO) from being interpreted as a delimiter of the first URL (URLONE).

There are several other redirection parameters used on a sort of ad-hoc basis throughout QuickBase. On the sign-in page the parameter nexturl is used to indicate which URL to redirect to after a successful login. I think I have seen about a half dozen different redirection parameters in various parts of QuickBase.