APIs & Integrations

AMoulin
メンバー

Error 404 retrieve Form uploaded file

解決

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 いいね!
1件の承認済みベストアンサー
AMoulin
解決策
メンバー

Error 404 retrieve Form uploaded file

解決

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.

元の投稿で解決策を見る

7件の返信
AMoulin
解決策
メンバー

Error 404 retrieve Form uploaded file

解決

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
キーアドバイザー

Error 404 retrieve Form uploaded file

解決

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 いいね!
AMoulin
メンバー

Error 404 retrieve Form uploaded file

解決

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
トップ投稿者 | Gold Partner
トップ投稿者 | Gold Partner

Error 404 retrieve Form uploaded file

解決

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
メンバー

Error 404 retrieve Form uploaded file

解決

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
メンバー

Error 404 retrieve Form uploaded file

解決

tried without the content-type, did not change anything

dsmarion
トップ投稿者 | Gold Partner
トップ投稿者 | Gold Partner

Error 404 retrieve Form uploaded file

解決

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