mirror of https://github.com/go-gitea/gitea.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
a90af22003
This PR fixes inconsistencies between system and default webhooks in the Gitea API. (See also #26418) - A system webhook is a webhook that captures events for all repositories. - A default webhook is copied to a new repository when it is created. Before this PR `POST /api/v1/admin/hooks/` creates default webhooks (if not configured otherwise) and `GET /api/v1/admin/hooks/` returns system webhooks. The PR introduces an optional query parameter to `GET /api/v1/admin/hooks/` to enable selecting if either default, system or both kind of webhooks should be retrieved. By default the flag is set to return system webhooks keep current behaviour. ## Examples ### System Webhooks #### Create ``` POST /api/v1/admin/hooks/ { "type": "gitea", "active": false, "branch_filter": "*", "events": [ "create", "..." ], "config": { "url": "http://...", "content_type": "json", "secret": "secret", "is_system_webhook": true // <-- controls hook type } } ``` #### List ``` GET/api/v1/admin/hooks?type=system //type argument is optional here since it's the default ``` #### Others The other relevant endpoints work as expected by referencing the hook by id ``` GET /api/v1/admin/hooks/:id PATCH /api/v1/admin/hooks/:id DELETE /api/v1/admin/hooks/:id ``` ### Default Webhooks #### Create ``` POST /api/v1/admin/hooks/ { "type": "gitea", "active": false, "branch_filter": "*", "events": [ "create", "..." ], "config": { "url": "http://...", "content_type": "json", "secret": "secret", "is_system_webhook": false // optional, as false is the default value } } ``` #### List ``` GET/api/v1/admin/hooks?type=default ``` #### Others The other relevant endpoints work as expected by referencing the hook by id ``` GET /api/v1/admin/hooks/:id PATCH /api/v1/admin/hooks/:id DELETE /api/v1/admin/hooks/:id ``` |
4 weeks ago | |
---|---|---|
.. | ||
actions | 4 weeks ago | |
activities | 4 weeks ago | |
admin | 4 months ago | |
asymkey | 4 weeks ago | |
auth | 1 month ago | |
avatars | 11 months ago | |
db | 4 weeks ago | |
dbfs | 8 months ago | |
fixtures | 4 weeks ago | |
git | 2 months ago | |
issues | 4 weeks ago | |
migrations | 4 weeks ago | |
organization | 4 weeks ago | |
packages | 1 month ago | |
perm | 2 months ago | |
project | 1 month ago | |
pull | 4 weeks ago | |
renderhelper | 2 months ago | |
repo | 4 weeks ago | |
secret | 6 months ago | |
shared/types | 12 months ago | |
system | 1 year ago | |
unit | 3 months ago | |
unittest | 1 month ago | |
user | 4 weeks ago | |
webhook | 4 weeks ago | |
main_test.go | 1 year ago | |
repo.go | 1 month ago | |
repo_test.go | 1 month ago |