ContributionsMost RecentMost LikesSolutionsRe: Looking for simplest example to access quickbase using pythonI know that this is old...but I got here from a Google search for simple example so I wanted to help the next guy/gal out. Here is my "simplest example." #!python3 import requests import xmltodict from xml.etree import ElementTree as et import pprint pp = pprint.PrettyPrinter(indent=2) # ----------Add your personal stuff here:----------- yourEmail = 'your@email.here' yourPassword = 'verygoodpassword' aTableID = 'xxx5yyyyy' companyURLPrefix = 'joescookies' # -------------Authenticate to get a ticket-------------- # one could use a user token here instead. headers = { "Content-Type": "application/xml", "Accept-Charset": "utf-8", "QUICKBASE-ACTION": "API_Authenticate" } # build an XML payload payload = et.Element('qdbapi') username = et.SubElement(payload, 'username') username.text = yourEmail password = et.SubElement(payload, 'password') password.text = yourPassword # hours = et.SubElement(payload, 'hours') # Optional # hours.text = '24' # Optional # make the payload ready for shipping humanPayload = et.tostring(payload) url2 = f'https://{companyURLPrefix}.quickbase.com/db/main' resp = requests.post(url2, data=humanPayload, headers=headers) # pp.pprint(vars(resp)) # Parse the response so we can pull out the ticket parsed = et.XML(resp.text) authticket = parsed.find('ticket').text # -----------Using the authticket we can actually do some work-------------- # this example is to get the API_GetDBInfo url3 = f'https://{companyURLPrefix}.quickbase.com/db/{aTableID}' headersGetDB = { "Content-Type": "application/xml", "Accept-Charset": "utf-8", "QUICKBASE-ACTION": "API_GetDBInfo" } # build another XML payload payloadGetDB = et.Element('qdbapi') ticket = et.SubElement(payloadGetDB, 'ticket') ticket.text = authticket # make the payload ready for shipping humanPayloadGetDB = et.tostring(payloadGetDB) respgetdb = requests.post(url3, data=humanPayloadGetDB, headers=headersGetDB) # print(et.XML(respgetdb.text).find('errtext').text) # this checks for the errtext # pp.pprint(vars(respgetdb)) # this pumps out the full response # This makes the response a little nicer to sort through parsedGetDB = et.XML(respgetdb.text) # This is some of the info enbedded into the XML response. parsedGetDB.find('dbname').text parsedGetDB.find('lastModifiedTime').text parsedGetDB.find('lastRecModTime').text parsedGetDB.find('createdTime').text parsedGetDB.find('numRecords').text parsedGetDB.find('mgrID').text parsedGetDB.find('mgrName').text parsedGetDB.find('time_zone').text parsedGetDB.find('version').text ------------------------------ David Choi ------------------------------ Re: API_GetUserInfo problem?Well...woops. For anyone out there, my problem was I was using: requests.get() I should have been using: requests.post() Also, I was using the wrong URL...that one needs to be: https://companyname.quickbase.com/db/main I was trying to use to use: https://companyname.quickbase.com ------------------------------ David Choi ------------------------------ API_GetUserInfo problem?I was trying the API_GetUserInfo call and was getting an unexpected result from the API. It's returning "Received err #5 : No Such Operation." All the other API calls I make are coming through as expected. I'm using Python and customizing the PyQB library to add in some user management functionality. My API_SendInvitation,API_ProvisionUser, and API_ChangeUserRole are all working properly. My XML request looks like this: <qdbapi> <email>test@test.com</email> <ticket>secretTicketStuff</ticket> <encoding>UTF-8</encoding> </qdbapi> Header looks like: headers={ "Content-Type":"application/xml", "Accept-Charset":"utf-8", "QUICKBASE-ACTION":"API_GetUserInfo" } Can anybody run that API call successfully and see if it's just me? (It smells like the server to me.) ------------------------------ David Choi ------------------------------