Personalized Community is here!
Quickly customize your community to find the content you seek.
Check out the latest Business Central updates!Learn about the key capabilities and features of Dynamics 365 Business Central and experience some of the new features.
Download overview guide | Watch Business Central video
2020 Release Wave 2Discover the latest updates and new features to Dynamics 365 planned through March 2021.
Release overview guides and videos Release Plan | Preview 2020 Release Wave 2 TimelineWatch the 2020 Release Wave 1 virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
Has anybody managed to successfully delete a webhook subscription?
At the time of writing either the ambiguous documentation is wrong, or the delete capability just doesn't work.
I'm using Postman with Basic authentication. I've tried
but this just returns HTTP 404, with message "Bad Request - Error in query syntax."
NB: 'e2f422a98b8b444ba0103db78e7c5830' is the subscriptionId from the Get Subscriptions call
I've tried the syntax given in the documentation:
But this gives a 401 Unauthorised, as you would expect - all the API calls return a 401 if you omit the tenant ID or get it wrong. I've even tried crazy variations in a desperate attempt to guess the intent of the developers or the documentation authors.
but they all fail with a 404 status code. Am I missing something, or is this functionality just broken?
It turns out that the documentation is broken.
In case there are other people struggling with this same thing, it turns out that there are some major omissions in the documentation around updating and deleting Business Central webhook subscriptions. My examples below use the beta forms of the urls, but at the time of writing the documentation for the v1.0 API was exactly the same.
1. The subscription ID that you use with the DELETE or PATCH methods needs to be in single quotes. It is not enough to simply put the subscription ID in brackets as per the documentation. The URI needs to look like this:
2. You need to pass an If-Match header containing the value of the subscription's ETag. If you don't, you get a 400 Bad Request with the code "BadRequest_InvalidToken" and the message "Could not validate the client concurrency token required by the service. Please provide a valid token in the client request."
You can get the ETag from the get-subscriptions call, there is one for every subscription. You'll see a property named "odata.etag", it will have a value that is displayed in Postman as something like this:
In Postman, I added an If-Match header to my DELETE call with the value
All I did here was take the value of the @odata.etag property and unescape the quote symbols, i.e. changed \" to ". The format must match exactly - if anything is amiss here, e.g. you omit the closing quote, you get a 400 error with "Request data is invalid."
3. In the particular case of the PATCH request to update a subscription, you need to send a Content-Type header with the value of application/json. Otherwise you get a 415 Unsupported Media Type error with the message "The request entity's media type 'text/plain' is not supported for this resource."
Note also that updating a subscription with the PATCH command also updates its ETag, naturally enough.
Business Applications communities