API : Pin webhooks to a specific API version - #25209
Open
f2cmb wants to merge 1 commit into
Open
Conversation
f2cmb
marked this pull request as ready for review
August 20, 2026 13:33
cconard96
approved these changes
Aug 20, 2026
| 'table' => self::getTable(), | ||
| 'field' => 'pinned_version', | ||
| 'name' => __('API version'), | ||
| 'massiveaction' => false, // must be one of the pinnable versions, not free text |
Member
There was a problem hiding this comment.
Massive action updates could be supported by adding a getSpecificValueToSelect method in this class.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Webhooks build their payload by calling the HL API internally, and that internal request never carried a version header, so the router always fell back to
Router::API_VERSION. That is harmless while v2 is the only major, but the day v3 becomes the default, every existing webhook would start sending v3 payloads without anyone having changed anything on their side.Each webhook now stores the API major version its payload is built against:
pinned_versioncolumn and a dropdown on the webhook formWebhook::getAPIResponse()sends it as theGLPI-API-VersionheaderOnly majors can be pinned, the router already resolves them to their latest minor. v1 is excluded since it is routed to the legacy API and would resolve no webhook path.
Nothing changes today: "2" resolves to 2.4.0, which is already the router default, so payloads are identical before and after. The dropdown holds a single entry until v3 ships.
Left out on purpose : the itemtype list still offers ITIL subtypes whatever the pinned version, since they are named from a static map instead of the schemas, and the Monaco suggestions endpoint does not carry the version yet. Both belong with the v3 work.
Screenshot :