Forum Discussion

AylanaVorster's avatar
Qrew Member
2 years ago

API Calls into Python

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" ?>
<errtext>No error</errtext>
<name>TABLE NAME TEMP</name>

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

3 Replies

  • Hello. Where are you making this call from? What languages are you using (java, javascript, .net, etc)?

    Marcelo Benavides Torres

    • AylanaVorster's avatar
      Qrew Member
      Good day!

      I am using requests method in python by posting a URL with the API call in it

      Aylana Vorster