Forum Discussion

EdwinReik's avatar
EdwinReik
Qrew Member
3 years ago

Building URL to download CSV

I'm building some automations outside of Quickbase and have found the best way to pull data has been to build a URL using a usertoken that pulls data into a CSV that I process externally with python. 

For previous tables I've used this basic format:
qb URL: https://company.quickbase.com/db/dbID?a=q&qid=34

url = 'https://company.quickbase.com/db/dbID(from original URL)?a=api_genresultstable&qid=34(from original URL)&options=csv&usertoken=private_token'


However, when i build a URL call based on the URL below it pulls data from the wrong table... WHY.

https://company.quickbase.com/db/dbID?a=q&qid=31

​Would love some insight on how to adjust my URL call to have it pull the correct data. 

p.s. this works as long as I'm already signed in, but I need to do this when I'm not necessarily signed in:

https://company.quickbase.com/db/dbID&opts=csv

Thanks, 
Ed

------------------------------
Edwin Reik
------------------------------

7 Replies

  • I think the better option might be for you to look into using the API. The URLs that you're using are meant for access via the UI, so probably not the best way for you to grab information via an automated method.

    QuickBase API

    ------------------------------
    Blake Harrison
    bharrison@datablender.io
    DataBlender - Quickbase Solution Provider
    Atlanta GA
    404.800.1702 / http://datablender.io/
    ------------------------------
      • BlakeHarrison's avatar
        BlakeHarrison
        Qrew Captain
        I'd suggest you look into querying your Quickbase data directly utilizing the API. If you're working with Python, you can use the REST API here: https://developer.quickbase.com/operation/runQuery 

        Select the Code Samples tab and select Python from the drop-down and you'll get this code as an example query:

        import json
        import requests
        
        headers = {
          	'QB-Realm-Hostname': '{QB-Realm-Hostname}',
        	'User-Agent': '{User-Agent}',
        	'Authorization': '{Authorization}'
        }
        body = {}
        r = requests.post(
        'https://api.quickbase.com/v1/records/query', 
        headers = headers, 
        json = body
        )
        
        print(json.dumps(r.json(),indent=4))
        ​


        ------------------------------
        Blake Harrison
        bharrison@datablender.io
        DataBlender - Quickbase Solution Provider
        Atlanta GA
        404.800.1702 / http://datablender.io/
        ------------------------------