Forum Discussion

ChadCox's avatar
ChadCox
Qrew Trainee
6 years ago

Quickbase API API_GenResultsTable HTTP POST as JSON examples

I have a URL like this to access QuickBase's API. I am using an HTTP 'GET' approach. How can I reformat this as a 'POST?'

https://abc.quickbase.com/db/babcd?a=API_GenResultsTable&qid=13&jsa=1&usertoken=abc123x

I am using Postman and a browser to send these requests. GET works fine, I would like to rewrite this as a JSON POST.  This site provides some clues, but not enough examples, https://help.quickbase.com/api-guide/gen_results_table.html

I need to post API_GenResultsTable, qid, jsa, and usertoken. I have tried doing this as JSON and as XML, no luck.

Sample XML Request

POST https://target_domain/db/target_dbid HTTP/1.0
Content-Type: application/xml
Content-Length:
QUICKBASE-ACTION: API_GenResultsTable 

<qdbapi>
   <ticket>auth_ticket</ticket>
   <apptoken>app_token</apptoken>
   <query>{'11'.CT.'Bob'}AND{'19'.GTE.'5'}</query>
   <clist>6.7.9.11.16</clist>
   <slist>11.6</slist>
   <fmt>structured</fmt>
   <options>num-4.sortorder-D</options>
</qdbapi>

Thanks for any help.

------------------------------
Chad Cox
------------------------------
  • ChadCox's avatar
    ChadCox
    Qrew Trainee
    I will go ahead and answer my own question.

    var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://company.quickbase.com/db/aasdasd",
    "method": "POST",
    "headers": {
    "Content-Type": "application/xml",
    "QUICKBASE-ACTION": "API_GenResultsTable",
    },
    "data": "<qdbapi>\r\n <usertoken>alkjeoriuwe,kans,kjda,ksdjlks,a</usertoken>\r\n <qid>187</qid>\r\n <jsa>1</jsa>\r\n</qdbapi>"
    }

    $.ajax(settings).done(function (response) {
    console.log(response);
    });

    ------------------------------
    Chad Cox
    ------------------------------