Answered

URL file from Typeform


Userlevel 2
Badge

Hello,

 

At the end of the typeform, people can submit a file to upload. 

 

Before the links were automatically created were like this: https://api.typeform.com/responses/files/c8b3bd71f8e0891236470967586627a63d550ee593577bab91b25e2bbfc4618a/download.png

 

And now they are like this: https://api.typeform.com/forms/vLDuiel6/responses/5v7vj05q2l833c5v7vj5kbuhkgbidahi/fi[…]/b7JEb7Ol2Evz/files/56a4068dc1b3-2.pdf

 

Since this change happened, we are not being able to open the link.

Does someone face the same issue? How can I fix this?

icon

Best answer by andrew_videoask 18 May 2022, 17:11

View original

16 replies

Userlevel 7
Badge +5

Hi @Calm Storm 👋

My assumption is that the change was made for security purposes.

In the first example, the image is visible to anyone on the web who has that link.

In the second example, you need to authenticate that you are the account owner before accessing the image.

Userlevel 2
Badge

But if I click on it, it doesn’t show the option to authenticate, it shows an error:

{"code":"AUTHENTICATION_FAILED","description":"Authentication credentials not found on the Request Headers"}

 

Some hints on how to proceed?

Userlevel 7
Badge +5

@Calm Storm Where are you getting the second URL from?

I tried reproducing the issue by uploading an image to my own typeform, and it’s working as expected.

Userlevel 2
Badge

Could you open the URL and the file generated? Did it create a link like mine?

/responses…

or

/responses/file…?

 

Thank you for replying!

Userlevel 7
Badge +5

@Calm Storm Yep, I can access the file! The link is formatted as /responses/files...

I assume you’re retrieving the non-functional URL from a tool like Zapier. If so, I’d recommend using Webhooks by Zapier (specifically a Catch Hook) as the Zap trigger. I used that approach and received a working image URL.

Userlevel 2
Badge

How do I set it up? I’m sorry, I don’t have much experience as developer.

Userlevel 7
Badge +5

@Calm Storm 

  1. Create a Zap
  2. Choose “Webhooks by Zapier” as the Trigger
  3. Choose “Catch Hook” for the Trigger Event
  4. Copy the Custom Webhook URL
  5. Click the “Connect” tab within your typeform
  6. Click “Webhooks”
  7. Add a webhook and enter the Custom Webhook URL
  8. Turn on the webhook 
  9. Submit a test response through your typeform
  10. Click “Continue” in Zapier and test the trigger

Now you should see a “file_url” field that lets you access the file without authentication.

Userlevel 7
Badge +5

Were you able to follow the steps Andrew sent above, @Calm Storm? Let us know how it goes! 

Userlevel 2
Badge

Yes, I managed to include the Webhook and follow the steps!

But the Zap is still not working because the file is not being uploaded to Affinity, the other part of the integration. I’m trying to find the error, so all communities and support teams are trying to help!

Thank you so much @andrew_videoask! You are a genius!

 

 

Userlevel 7
Badge +5

I get it, @Calm Storm. Don't forget to let us know when you find the error!  

Userlevel 2
Badge

In the end I managed to make it work with the webhook.

Just to understand a little. Is this URL generated from Typeform or Zapier modified it? @andrew_videoask 

 

Thank you

@andrew_videoask 

Hi Andrew.  Earlier in this thread you advised of the need to authenticate following the the change to URL format for accessing images.  
 

Some context: We produce automated reports for a client based individual responses to a Typeform survey.  Response data gets forwarded to us via a webhook to an endpoint we configure on the typeform so we get the webhook contents as soon as a response is submitted. That webhook payload contains (among other things) the URL to the image a respondent has provided as response to a question.  We need to to retrieve the image the URL points to and insert it into the document we are creating on the fly.

I believe this process worked seamlessly prior to the change that this thread is dealing with the fallout from.

Are you able to advise an inline or dynamic authentication solution by specifying the specific commands and formats required to do this? (The process that runs the reporting has access to the authorization token for the account that owns the survey and we have he URL, so surely this should just just a matter of requesting the contents in the correct format if it can be shared with us? )

Thank you in anticipation.


 

Userlevel 7
Badge +5

@Reg da Rilla I just tested accessing/downloading the file_url field in the webhook delivery, and it’s working as expected (no authentication required) 🙂

@andrew_videoask   Hi Andrew. Thanks for checking.  How curious!  

Here is one of the URL’s I retrieved from an import of the form data.  (test data) 

https://api.typeform.com/forms/ReneM8dG/responses/huxdsdtdrg0h36h5x2chuxds5vrlst4d/fields/uU9pfbLlJs1e/files/e8de18d7746d-4D6B280A_97ED_4C7F_8B73_D0145BF83476.png (URL generated by Typeform) 

When I try to access it (not logged into Typeform at the time) by pasting into a browser, I get:

{"code":"AUTHENTICATION_FAILED","description":"Authentication credentials not found on the Request Headers"} 

I would assume you’d get the same result if you entered that URL in say your browser?

If that’s the case, what is the relevant difference between our use cases that cause you earlier test to succeed and mine to fail?  What an I missing here?

Thanks for your patience.

@andrew_videoask 

Solved!  I would guess you were running in an authenticated state, presumably logged into the Typeform account from which you obtained the webhook? (the “Owner account” - hence automatic authentication) 

I was not signed in to the “Owner account”,  so needed to include the appropriate authentication credentials as part the request to retrieve the file.

All good. 

 

Userlevel 7
Badge +5

@Reg da Rilla Interestingly, the link I used also worked in an Incognito window (when I wasn’t logged in).

Glad you found a solution for your use case though! 

Reply