add data to Quickbase using python requests library

  • 0
  • 1
  • Question
  • Updated 4 months ago
  • Answered
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!





Photo of Jake Rattner

Jake Rattner

  • 710 Points 500 badge 2x thumb

Posted 4 months ago

  • 0
  • 1
Photo of Jake Rattner

Jake Rattner

  • 710 Points 500 badge 2x thumb
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!
Photo of Tony Burks

Tony Burks

  • 60 Points
How were you able to get this in python?
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.
(Edited)
Photo of Jake Rattner

Jake Rattner

  • 710 Points 500 badge 2x thumb
  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