APIs & Integrations

silicium
Member

How to update file (attachment) content?

Hello everybody,

I am trying to update attachment content.
I use this method: https://developers.hubspot.com/docs/methods/files/post_files_file_id

But behavior is really strange for me.
I get correct answer from API. But file content seems to updated not so fast.
If I am trying to open attachment from attachment panel, it can have old content.
When I am trying to open this file via File manager, sometimes it has correct data, sometimes no.
It seems like Hubspot has a lot of servers for filing and they are synchronizing in some time.

Probably, I am not correct in my thinking.
Could you clarify this point?
Or probably I do something not right.

Thanks a lot!

0 Upvotes
6 Replies 6
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

How to update file (attachment) content?

Hi @kremenetskyi,

Yes, that’s still due to the caching of the file. It takes the same amount of time for the file to be deleted from the entire CDN.

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

How to update file (attachment) content?

Hi @kremenetskyi,

Thank you for your patience on this; this topic slipped under my radar. Replaced files will often update quickly, but they can take up to 2 hours to propagate across the our CDN. This Knowledge Base article has more details:

0 Upvotes
silicium
Member

How to update file (attachment) content?

Thanks for your answer.

silicium
Member

How to update file (attachment) content?

Hello,

@Derek_Gervais

Please, see what I am trying to do.
I am removing file using this method:

Delete file from the CDN, along with all thumbnails and associated content | COS...

POST /filemanager/api/v2/files/:file_id/full-delete


and after I am adding file with the same name.
But unfortunately I still see old file (
Is it the same behavior as you explained about cached files?

Thanks

0 Upvotes
silicium
Member

How to update file (attachment) content?

Hello,

Any ideas?

Is there way to update attached file?

0 Upvotes
silicium
Member

How to update file (attachment) content?

Hello,
I am still investigating the problem.

What I have now:

  1. If I upload new file, I mean file with new content but with old name using this method: https://developers.hubspot.com/docs/methods/files/post_files
    It doesn’t work correct almost always. Often I can see file with old content.

  2. If I try to update file content (it doesn’t matter if file name is new or old) using this method: https://developers.hubspot.com/docs/methods/files/post_files_file_id
    It doesn’t work correct almost always. Often I can see file with old content, but I can see that parameter “Updated” is always changed in File Manager.

I have found only one correct way how to add really new file to hubspot via API.
It is just uploading file with new content and new name.
It works always.

@Derek_Gervais Probably can you support me in my problem?

Thanks

0 Upvotes