Skip to main content
Question

API Calls into Python

  • December 1, 2022
  • 0 replies
  • 345 views

Hi all,

I'm quite struggling being able to select a field from the API responses. I'm using requests to do the initial call, but from there it's a jumble of XML and JSON and .loads and .dumps and xmltodict.parse and nothing has been working for me. 

I'm doing an API_DoQuery call, and it's returning the normal things  starting with:
<?xml version="1.0" ?>
<qdbapi>
<action>API_DoQuery</action>
<errcode>0</errcode>
<errtext>No error</errtext>
<dbinfo>
<name>TABLE NAME TEMP</name>
<desc></desc>
</dbinfo>
<variables>
</variables>
<chdbids>
</chdbids>
<record>

and then all the records start, and form those records, I only need one or two fields of data, so I would love some method where I can have 
array = API_data["FIELD NAME"]
or some other method just to get the data into workable forms. Otherwise, I'd have to handle the XML as a text file and go through each line in a way that
if "<field_name> is in i, then get the text right after it but before </field_name>
and it feels like a lot of unnecessary maupilation.

I would really appreciate some assistance.

Thank you!

------------------------------
Aylana Vorster
------------------------------
This topic has been closed for replies.

MarceloBenavide
Forum|alt.badge.img+8
Hello. Where are you making this call from? What languages are you using (java, javascript, .net, etc)?

Marcelo Benavides Torres



Forum|alt.badge.img+6
  • Quickbase Staff
  • December 2, 2022
Hi Aylana, you should use the REST API instead, since it returns JSON which python can easily parse.  You'll even find code samples in python!

https://developer.quickbase.com/operation/runQuery



------------------------------
Doug Henning
------------------------------