`published` / `unpublished` webhooks sent before content is available

126 Views Asked by At

So I'm trying to build a content pipeline with Kentico Cloud. One of the requirements is that pressing the big green Publish is not the final step of the process. The published content then has to be collected, its representation transformed and forwarded elsewhere. Subscribing to publish / unpublish webhook events then processing the related content looked like the way to go, but apparently these are sometimes firing before the content is available via the Delivery API.

What are my options? I really don't want to do polling - the nested structure of the content combined with the inability to filter by parent items makes it far from trivial.

1

There are 1 best solutions below

0
On BEST ANSWER

As it turns out, the answer is right there in the API docs: https://developer.kenticocloud.com/reference#list-content-types

X-KC-Wait-For-Loading-New-Content

If the requested content has changed since the last request, the header determines whether to wait while fetching content. This can be useful when retrieving changed content in reaction to a webhook call. By default, when the header is not set, the API serves old content (if cached by the CDN) while it's fetching the new content to minimize wait time. To always fetch new content, set the header value to true.