Docs: (undocumented) webhook push_events
enabled by default when using the API
-
Start this issue's title with Docs:
orDocs feedback:
.
Problem to solve
The documentation makes no mention of any events that might be enabled by default when adding a webhook through the API: https://docs.gitlab.com/api/project_webhooks/#add-a-webhook-to-a-project
However, the push_events
do seem to be enabled by default and they have to be explicitly set to false
to be disabled.
Further details
Products tested on:
- GitLab Self-Managed
MRE (Python):
Alternatively replace httpx
with requests
import httpx
httpx.post(
"https://gitlab.example.com/api/v4/projects/<project_id>/hooks",
headers={"PRIVATE-TOKEN": "your-access-token"},
json={
"name": "test_hook",
"url": "http://192.168.79.53:8080/releases",
# "push_events": False,
"releases_events": True,
"enable_ssl_verification": False,
"token": "very-secret-token-especially-since-ssl-verification-is-disabled",
},
)
With this code I get a webhook added to the project with the Push Events enabled
That is completely unexpected as the documentation fails to mention any such behaviour and to disable this I have to POST a request with push_events: false
(uncomment the commented out line in the code above and run it again).
Proposal
Ideally I would expect the behaviour of the API endpoint to change and for it to not have any such defaults, but at the very least, this should be documented in a way that it is clearly visible on the documentation page, see picture below for some options:
AND it should also be mentioned somewhere in the description of the attribute:
AND, perhaps, also specify (provide an example of) how to disable it.