Forum Discussion

GeoffBarrenger's avatar
GeoffBarrenger
Qrew Trainee
3 years ago

API_DoQuery Response Different in Web vs Terminal AppToken/UserToken

Hi,

Having trouble getting a DoQuery result to work with curl in terminal.  Trying to do this way to then parse out for what I actually need. 

End goal is:
1) user scans a QR code with a client
2) client sends the QR code to QuickBase
3) QuickBase returns with an image URL corresponding to that QR code
4) client displays the image to the user

When I do the call in the web browser with apptoken, I get the expected result (needs to be logged in).  When I do the call in terminal with usertoken, I get a response but the response doesn't have any data in the response.   Any ideas?
(I also noticed I needed to use %27 instead of quotes in the web browser)

I am searching field 6 to see if "1427445" is contained in that field and field 6 contains "alternate10"
expected response is the file name and the URL

Interestingly, when I did an API_Authenticate, and then tried in terminal with apptoken and ticket, I still got the same result!!!

Web Browser:

https://domain.quickbase.com/db/table?a=API_DoQuery&apptoken=xxxxxxxxxxxxxxxxxxxxx&includeRids=1&query={%276%27.CT.%271427445%27}AND{%276%27.CT.%27alternate10%27}&clist={26.6.52}
Result ( This works ):

<qdbapi>
<action>API_DoQuery</action>
<errcode>0</errcode>
<errtext>No error</errtext>
<dbinfo>
<name>Assets</name>
<desc>Assets available in AEM / ASC.</desc>
</dbinfo>
<variables> </variables>
<chdbids> </chdbids>
<record rid="1158942">
<filename>s7-1427445_alternate10.psd</filename>
<social_url>RESPONDS WITH THE URL TO AN ASSET WHICH I NEED SUCCESSFULLY</social_url>
<update_id>1631916573812</update_id>
</record>
</qdbapi>


Terminal:

curl "https://domain.quickbase.com/db/table?a=API_DoQuery&usertoken=xxxxxxxxxxxxxx&includeRids=1&query={'6'.CT.'1427445'}AND{'6'.CT.'alternate10'}&clist={26.6.52}"

Response ( does not work ):

<?xml version="1.0" ?>

<qdbapi>

<action>API_DoQuery</action>

<errcode>0</errcode>

<errtext>No error</errtext>

<dbinfo>

<name>Assets</name>

<desc>Assets available in AEM / ASC.</desc>

</dbinfo>

<variables>

</variables>

<chdbids>

</chdbids>

</qdbapi>

 



------------------------------
Geoff Barrenger
------------------------------

1 Reply

  • Hi - Just in case anyone else searches and finds this, figured it out:

    curl -X POST 'https://domain/db/table' -H 'Content-Type: application/xml' -H 'Content-Length:' -H 'QUICKBASE-ACTION: API_DoQuery' -d ' <qdbapi> <usertoken>xxxxxxxxxxxxxxxx</usertoken> <query>{6.CT.1427445}AND{99.EX.TRUE}</query> <clist>74.104.52</clist> <slist>98</slist> </qdbapi>'

    The XML format doesn't return correctly in terminal - but if you pass it as xml you can get the desired result.  I still don't know why the URL version doesn't work as well - probably a formatting or quotations issue, but this turned out great.   



    ------------------------------
    Geoff Barrenger
    ------------------------------