General question about using Contentful like a CDN

There is some interest in my organization for using Contentful as a CDN where we would have a scheduled process that would upload a set of images on a nightly schedule. Actual human users wouldn’t modify these images. I’m not sure how that would look. Maybe we’d programatically remove the old assets and then update a bunch of existing entries with the newly update asset ids.

Can anyone give me their opinion on whether that’s a good idea? Has anyone done it? It is a bit odd because a huge part of the power of Contentful is the nice UI. I also have concerns about making sure that humans don’t accidentally change this content.

Hey @dustin.aleksiuk,

probably you’ll want to use one of our SDKs to wire up the logic. We’re “API first” - that means we actually embrace automated editing experiences.

When you’ve created an Asset (either via UI or via our API) you can link this Asset to an Entry. You can then retrieve this Entry which will include a URL to the file of the Asset. (This explanation is a bit oversimplified, but we have good tutorial on our “Concepts” page).

When you then update the Asset with a new file via one of the SDKs (or the CMA directly), it will create a new version and once published, your Entry will point toward that new version. This means when you query the Entry the next time, the file URL will have changed, now pointing towards the updated file.

With our versioned Assets there’s no need to remove the old file, it will stay valid, so that old links to the file URL won’t break.

Restricting manual edits is a different topic and it depends on the plan you have. We have some explanation in our “Knowledge Database” for you.

Does this help?

Best,
Stephan

1 Like

Thanks Stephan, that does help.

1 Like