You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to be able to update webhooks using the contentful space import command. Currently, the command only capable of creating webhooks, but fails when attempting to update them.
Expected Behavior
The import of a webhook with an existing id results in a successful update.
Export the webhook definition of that space using the contentful space export command.
Change the name of the webhook in the exported file.
Import the webhook in the same space using the contentful space import command.
Context
I want to maintain my webhooks using an infrastructure as code approach. The contentful space import command seemed like a perfect fit. However, due to this limitation I was forced to implement a custom solution. I would like to not have to maintain a custom solution and instead be able to utilize the official CLI.
Environment
See the X-Contentful-User-Agent HTTP header in the Actual Behavior section.
The text was updated successfully, but these errors were encountered:
Hey @marcogrcr thanks for the question! You are correct that the default import behavior does not correctly handle updating webhooks, as it needs a version number which is not natively included in the import. I've added a ticket to our board to track this work, though I'm not sure when we will exactly get to it. In the meantime, a possible workaround that may or may not be useful:
--
Before running the import, use the Contentful Management API to fetch the existing webhooks and their versions. You can do this by querying your space for the list of existing webhooks and retrieving the sys.version for each webhook.
Example with contentful-cli:
contentful webhook get --space-id <space_id> --environment-id <environment_id> --webhook-id <webhook_id>
Modify the webhook data in your import file to include the sys.version field for each webhook definition. For example:
This ensures that the correct version is sent with the update request, allowing the update to proceed without conflicts. Like I said, not knowing your workflow for imports this may not necessarily be a great solve, so feel free to ignore.
I would like to be able to update webhooks using the
contentful space import
command. Currently, the command only capable of creating webhooks, but fails when attempting to update them.Expected Behavior
The import of a webhook with an existing id results in a successful update.
Actual Behavior
The import fails with the following error:
Possible Solution
Based on a superficial analysis, it should be enough to populate the
webhooks
field of AllDestinationData in getDestinationData(), since it's currently set to an empty array.Steps to Reproduce
contentful space export
command.contentful space import
command.Context
I want to maintain my webhooks using an infrastructure as code approach. The
contentful space import
command seemed like a perfect fit. However, due to this limitation I was forced to implement a custom solution. I would like to not have to maintain a custom solution and instead be able to utilize the official CLI.Environment
See the
X-Contentful-User-Agent
HTTP header in the Actual Behavior section.The text was updated successfully, but these errors were encountered: