Forum Discussion

JakeRattner2's avatar
JakeRattner2
Qrew Trainee
6 years ago

add data to Quickbase using python requests library

Does anyone know how to send data to Quickbase using Python?  I'm trying to upload a CSV object to a table.  I'd be happy to start with the simplest example of a working GET or POST to send even one record to QB.

I want to ask the question generally, but ultimately I want to be able to POST a csv object to a Quickbase table for the purpose of running a Machine Learning model outside of Quickbase and posting the results back to the table's records.

Thanks!





5 Replies

    1. I imported 'Requests' and used the Quickbase API.
    2. I defined a csv object based on my data model and called it 'Test'
    3. Then I retrieved my application data looking for my authorization ticket using: 
      request = requests.get('https://domainquickbase.com/db/main?a=api_authenticate&username=X&password=X�
    4. I then used regex to extract the ticket from the returned xml and called the ticket 'found'
    5. I then posted the data from my csv object 'test' and passed in my auth ticket 'found':
      headers = {'Content-Type':'application/xml','QUICKBASE-ACTION':'api_importfromcsv'}  data = '<qdbapi><ticket>'+found+'</ticket><records_csv><![CDATA['+test+']]></records_csv>  <clist>1.2.3</clist><apptoken>TOKEN</apptoken></qdbapi>'
      r = requests.post(url = �END_PT_URL�, data = data, headers=headers) 

    I'm sure there are even better ways to do this. If anyone has a method I would love to know. 


    Jake Rattner | Solutions Architect
    (847) 927-1427 | jrattner@quandarycg.com
    Quandary Knowledge Base
  • Resolved this.  Can share if anyone is interested.  If you use Python with QB please reach out.  Would love to know about how you're using it!
    • EdwinReik's avatar
      EdwinReik
      Qrew Member
      Are you still working with Python and Quickbase? I could use help writing API calls using post requests

      ------------------------------
      Edwin Reik
      ------------------------------
  • Besides this, there are SDKs for Python and QuickBase that I wrote an article about in linkedin in the past, But I think the response = request() construct is probably the best way.

    @Jake, please feel free to share how you did it.