APIs & Integrations

AMoulin
Miembro

Error 404 retrieve Form uploaded file

resolver

Hi,

 

I created a form with a form field and I'm using api to retrieve submissions of that form.

When I try to use the url given by the submission to download the file using API token it returns a 404 error, but when I open the url in a browser (while being authenticated) it correctly shows the file.

 

I put in scopes for the app :

  • forms
  • forms-uploaded-files
  • files.ui_hidden.read
  • files

I expect ony the two first scopes should be necessary.

 

Am I missing something ?

0 Me gusta
1 Soluciones aceptada
AMoulin
Solución
Miembro

Error 404 retrieve Form uploaded file

resolver

We found that the issue came from the request client class used in our framework. This class is trying to follow itself the redirections to make the requests using final IP address instead of domain name, and it seems that at some point it looses some requested data.

Ver la solución en mensaje original publicado

7 Respuestas 7
AMoulin
Solución
Miembro

Error 404 retrieve Form uploaded file

resolver

We found that the issue came from the request client class used in our framework. This class is trying to follow itself the redirections to make the requests using final IP address instead of domain name, and it seems that at some point it looses some requested data.

Humashankar
Asesor destacado

Error 404 retrieve Form uploaded file

resolver

This may be because of token has no sufficient permissions to access files uploaded via forms

Humashankar VJ
HubSpot Community Champion and enthusiast | Engineering Manager
0 Me gusta
AMoulin
Miembro

Error 404 retrieve Form uploaded file

resolver

where theses permissions are configured ? I mean I'm confused, it's an app, it should have access to all by default, restriced by the scopes at most.

dsmarion
Colaborador líder | Partner nivel Gold
Colaborador líder | Partner nivel Gold

Error 404 retrieve Form uploaded file

resolver

Hmmm... 404 means not found, it's not a permissions issue.  That would be 401 or 403.  Can you show more info about your api call?  I am guessing something else is the culprit.

Scott Marion
Senior Developer @ Thread Connected Marketing
AMoulin
Miembro

Error 404 retrieve Form uploaded file

resolver

basically it's that :

        $headers = [
            'Authorization' => "Bearer {$this->accessToken}",
            'Content-Type' => 'application/json',
        ];
        $response = (new ExternalResourceClient())->request('GET', $url, null, $headers);

the URL is exactly the one recieved while retrieving the submission from the api calls, it looks like that :

https://api-na1.hubspot.com/form-integrations/v1/uploaded-files/signed-url-redirect/XXXXX?portalId=XXXX&sign=XXX&conversionId=XXX&filename=XXX.pdf

the same code works to retrieve submissions

the same url works on browser to get the file

 

I'm thinking i did not try without the content-type, might cause some issues

AMoulin
Miembro

Error 404 retrieve Form uploaded file

resolver

tried without the content-type, did not change anything

dsmarion
Colaborador líder | Partner nivel Gold
Colaborador líder | Partner nivel Gold

Error 404 retrieve Form uploaded file

resolver

Maybe.  Also not sure if you need to urlencode.  I have not used this endpoint so can't give any examples or help much further.  Maybe some else will chime in..

Scott Marion
Senior Developer @ Thread Connected Marketing