Forum Discussion

HemanthH_'s avatar
HemanthH_
Qrew Member
3 years ago

How to download File attachments using API ?

I am trying to download the files from my Quickbase table using the download file API (https://developer.quickbase.com/operation/downloadFile), but I only get the data in base64 format. How do I download the file itself ?

------------------------------
Hemanth
------------------------------
  • You need to decode the base64 into a byte string and write it to a file i am not sure what language you are using but in python it would look something like this

    dl_file = //get you file from quickbase
    
    //assuming the file is a png image
    import base64
    with open("img.png", "wb") as fh:
        fh.write(base64.decodebytes(dl_file))
    ​


    ------------------------------
    Simon H
    ------------------------------
    • HemanthH_'s avatar
      HemanthH_
      Qrew Member
      I am using PowerShell. The file is a AES KEY, used to encrypt confidential data. When I convert from Base64, it seems to be adding some extra characters at the beginning. 

      Is there a way to download the file itself, rather than getting the data in Base64 format ?

      ------------------------------
      Hemanth H.
      ------------------------------