Discussions

 View Only
  • 1.  Access Record data from an html page via API call

    Posted 01-17-2019 22:19
    I have had a hard time getting accustomed to working with API calls from outside of Quick Base and since I have limited experience with XML. Finally after struggling quite a bit I have come up with a (seemingly) decent method for getting/accessing record data from an API call in an HTML page.

    I will post the code below and please provide any feedback for this method, I am still early using Quick base API calls. This method uses the option to return the record data as a 2-dimensional array that can be accessed with "qdb_data[x][x]" where the "x" is the index selector. You can easily check the number of returned records by looking at "qdb_data.length"


    <head>
    <script lang="javascript" src="yourdomain/db/
    yourtable?a=API_GenResultsTable&query={'field id'.operator.matchvalue}&jsa=1&apptoken=[yourtoken]">
    </script>
    <script>
    function displayData(){
    alert(qdb_data[x][x]);
    }</script>
    </head>

    Curious about the security of having the API info and app token within the client-side code. Obviously a QB code page is fairly secure compared to a remote code page but still curious about it. 

    Thanks everyone.


  • 2.  RE: Access Record data from an html page via API call

    Posted 01-21-2019 15:33
    Just figured I would add code for how to pull values into the code page from a URL button within QB. Just replace "rid" with the name of your parameter name.

    <script>
    function getUrlParameters() {
        var params = {};
        var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
            params[key] = value;
        });
        return params;   }
    function doCode(){
    var recordID=getUrlParameters() ["rid"]; 
    alert(recordID); 
     }
    </script>


  • 3.  RE: Access Record data from an html page via API call

    Posted 01-21-2019 15:40
    This is one way to make further API calls after processing data on code page -->

    var request = new XMLHttpRequest();
    request.open('POST', 'https://yourdomain.quickbase.com/db/yourtable?a=API_">https://actionpaqcorporation.quickbase.com/db/bn77yhxzn?a=API_AddRecord&_fid_6='+date+">https://yourdomain.quickbase.com/db/yourtable?a=API_yourAPIcall&apptoken=yourapptoken', true);
    request.onload = function () {
      alert("record added");


  • 4.  RE: Access Record data from an html page via API call

    Posted 01-21-2019 15:40
    No need for a custom function as all modern browsers now support URLSearchParams
    var urlParams = new URLSearchParams(window.location.search);
    var recordID = urlParams.get("rid"));
    alert(recordID); 
    https://caniuse.com/#feat=urlsearchparams">https://caniuse.com/#feat=urlsearchparams">https://caniuse.com/#feat=urlsearchparams