Avoiding race conditions while using the Content Management API with Webhooks


Would be lovely to have the option NOT to fire any Webhook while updating the site’s content through the Content Management API.

Use case: Record Published Event → Webhook fires a request to my server endpoint → Server manipulates the data → Server updates the Record through the API → Server publishes the Record through the API.

Today, this fires another event which creates a loop.

The reason why the server has to first update then publish is that otherwise the record appears as draft (Dato does not allow to use the /:item_id/publish query while passing some updated data, which is a shame).

This could be achieved through some basic boolean in the query (defaulting to true, of course, ie: “/:item_id/publish?trigger_event=false” would publish the record without triggering the webhook event).