How to update file (attachment) content?


#1

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!


#2

Hello,

Any ideas?

Is there way to update attached file?


#3

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


#4

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:


#5

Thanks for your answer.


#6

Hello,

@Derek_Gervais

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


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


#7

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.