File uploads: Downloading the files uploaded to the form through the API not working

  • Profile Image
    atleta
    Asked on February 01, 2017 at 11:28 PM

      Hi,

     

    I'm working on a solution to export the jotform data into our system for further processing, but I can't make file download work. Though documentation doesn't mention it, but the files can't be downloaded without authentication. Providing the API key doesn't seem to be enough (at least the fetch_url returns a 404, just as an unauthenticated session in the browser). I hope we don't have to resort to password authentication (or worse, having to simulate a log in). What's the solution here?

     

      Thanks,

        Laszlo

  • Profile Image
    owen
    Answered on February 02, 2017 at 02:20 AM

    Hi Laszlo,

    Authentication should actually work with your API key as long as you are trying to download the uploaded files of your own account. You should not need to simulate a login through API. In the documentation there is a part where downloading files is described under use cases, please have a look at it:

    https://github.com/jotform/api-use-cases/tree/master/ruby-uploaded-files-downloader

    I hope this helps.

    Please contact us again if you need any further assistance.

  • Profile Image
    atleta
    Answered on February 02, 2017 at 09:59 AM

    Hi Owen,

    Unfortunately jotform turned out to be an extremely frustrating experience. I have been writing a detailed report of what I was doing, with screenshots for an hour that I wasn't able to send at first because of this (post button doesn't work):

    Then, after editing I got this (see next message, due to the bug above)

  • Profile Image
    atleta
    Answered on February 02, 2017 at 10:01 AM

    My whole comment complete with screenshots eaten by your stupid spam checker:

  • Profile Image
    atleta
    Answered on February 02, 2017 at 10:26 AM

    After having wasted over an hour and not being able to post the links to the anonymized screenshots, because obviously lilks==spam in a closed customer support forum protected by google's reCAPTCHA, you'll have to take my word for it:

    I tried the ruby example and it doesn't work. No surprise, it doesn't do authentication for the file download. You'll have to grok the source yourself as your very smart and absolutely necessary spam filter will reject github links as well. (Hint: line 25 of the .rb file in the repo you have linked to.)

    Same thing for the python example (that had other bugs besides that needed to be fixed in order to make it work at all). No authentication attempt here either see downloadThread.py line 24 in the python donwload sample repo.

     

    I have also tried using python requests:

    In [47]: import requests

    In [48]: requests.get('[removed to protect privacy and to bypass spam filter].....doc', headers={'apiKey': '[our api key]'})

    Out[48]: <Response [404]>

     

    And the API client, which has a method for this. fetch_url (the method that gets called by all other API methods) also fails.

  • Profile Image
    Mike
    Answered on February 02, 2017 at 11:38 AM

    Please accept our sincere apologies for the inconveniences you are facing.

    I suspect that the issue might be related to the 'Require log-in to view uploaded files' option under account settings which has been recently implemented at JotForm.

    Could you please do a quick test? If this is the case, we can forward a ticket to or developers to see if they can offer any solution.

  • Profile Image
    atleta
    Answered on February 02, 2017 at 12:30 PM

    Hi Mike,

     

    We had it on. Switching off allows downloading of the files (without an API key as well, of course), but leaves my partners concerned. My guess it that the download endpoint does not handle the API key authentication. At least not when passed in the headers. (I have not played with the other options.)

    The error message from the server shouldn't be a 404 but 401.

    Also, can you please get in touch over email, as I'm getting pestered by recaptcha and it's very hard to post a comment at all.

  • Profile Image
    Kiran
    Answered on February 02, 2017 at 01:52 PM

    Thanks for the confirmation. It seems that the file uploads can be authenticated only when the user is actually logged in. Let me forward the thread to our backend team to take a look. Once we have any information in this regard, you'll be posted here.

    You can also get in touch with us by sending an email to support@jotform.com. However, please be noted that this support forum is the primary support and the questions posted here are responded in a timely manner.

    Thank you!

  • Profile Image
    atleta
    Answered on February 02, 2017 at 09:37 PM

    Cool, thanks, will be waiting for it.

    Please also look into the issues I've reported about the forum itself above. B/c while you respond quickly in general, if I can't post a detailed description of what I'm doing/experiencing, then it doesn't mean much (see the first response from Owen, though that was uneducated beyond that).

  • Profile Image
    olivia
    Answered on February 03, 2017 at 01:12 AM

    Hi,

    We are sorry for the confusion again. 

    I need to open a new thread for your second issue about support forum interface.

    Please follow your issue from this thread: https://www.jotform.com/answers/1055600 

    If you need any other details, please feel free to let us know.

    Thank you.

  • Profile Image
    Rose
    Answered on September 14, 2017 at 02:31 AM

    As we discussed this issue further, we unfortunately can not provide this support. It is not possible to download uploaded files via API key. Since, login process is a must to download uploaded files. 

    We thank you for your understanding and please do let us know if you have more questions.