Forum Discussion

DFDK's avatar
DFDK
Qrew Member
2 years ago

API - File Attachment Download - Resource not found

Hello,

I have a problem downloading file attachments with the API.  My current language of choice is Python.

I have researched several articles on this topic however no joy yet.

If I query an attachment using the following syntax I can see the file in the browser.  So I know my user token and parameters are correct.

https://domain.quickbase.com/up/dbid/a/r_recordid/e_fileid/vversion?usertoken=user_token

However when I use the API to try to download the file I only get "Resource not found" as a response.

I have attached an image with my python script.

Any help / guidance would be greatly appreciated.  

Thanks!

------------------------------
Scott Paxton
------------------------------

8 Replies

  • DFDK's avatar
    DFDK
    Qrew Member
    Sorry one typo.  I meant to type fieldID not fileID in the url example.

    ------------------------------
    Scott Paxton
    ------------------------------
  • DougHenning1's avatar
    DougHenning1
    Community Manager
    Hi Scott,

    In the Authorization setting in headers, it appears you're just sending the token itself.  I think you meant to use:

    'Authorization': auth_str

    Hope that helps!

    ------------------------------
    Doug Henning
    ------------------------------
      • DougHenning1's avatar
        DougHenning1
        Community Manager
        Is the file you're downloading JSON?  If not then you'll get an error with those JSON commands.  You can access the body of the response with "r.content" or "r.text" depending on the file type.


        ​r = requests.get(
        request_str,
        headers = headers
        )
        print(r.content)


        ------------------------------
        Doug Henning
        ------------------------------