APIs & Integrations

snavas
Member

Files API Integration

I'm  trying to use the Files Api to fetch a file by ID and then view the file that have been attached as part of Engagements, like tasks/emails etc. The issue I'm having is, I can't view the file with the url (https://cdn2.hubspot.net/hubfs/....). I get a 404 error. If I try to use the s3_url, I get a 403 Forbidden error.

 

The file metadata shows the "hidden" property as TRUE. Could this be a problem? I'm looking at the demo here (https://developers.hubspot.com/docs/methods/files/get_files_file_id) and the files can be viewed just fine through the URL and "hidden" is set to FALSE.

 

Could this alternatively be because the files where attached through Engagements? Is there something that we can change through settings so that the files could be accessed publicly?

0 Upvotes
4 Replies 4
himanshurauthan
Thought Leader | Elite Partner
Thought Leader | Elite Partner

Files API Integration

Hello @snavas 

 

It may be a case that file do not allow anonymous access. You can check this in the meta of the file if the parameter is set to false. Also please try to use other parameters for accessing the file like: friendly_url, url, alt_url.

 

Also which oauth method you are using to make the API call? If its access token method then make sure you have valid scopes/permissions.

 

Thanks

Digital Marketing & Inbound Expert In Growth Hacking Technology
0 Upvotes
snavas
Member

Files API Integration

Any updates on this Himanshu? How do we allow secured access to the files?

0 Upvotes
MrLeif
Member | Partner
Member | Partner

Files API Integration

Any updates to change the allows_anonymous_access flag?

0 Upvotes
snavas
Member

Files API Integration

Thanks for such a quick response Himanshu! You are right, the "allows_anonymous_access" property is set to FALSE. Is there a setting where we can set it to TRUE. Or is this because it's an attachment on an Engagement?

 

Btw, I'm using the hapikey for authentication.

0 Upvotes