Manage GitLab Webhook
Since QuickBuild 15.0, you can manage GitLab Webhook settings via REST API.
API Permissions
The permissions for GitLab Webhook Configuration settings should be granted EDIT_SETTINGS of the configuration.
List GitLab Webhook Configuration Settings
GET /rest/webhook/gitlab/configuration_settings/{configurationId}
replace configurationId to the actual id of the configuration you want.
By default, the media type of return result is XML, you can add request header Accept to change the media type, for example, add below header to get JSON result:
Accept: application/json
Update GitHub Webhook Configuration Settings
POST /rest/webhook/gitlab/configuration_settings/{configurationId}
replace configurationId to the actual id of the configuration you want.
{
"secret": "mysecretlife",
"username": "admin",
"condition": "target == \"android\"",
"variables": [
{
"name": "url",
"value": "http://localhost"
}
]
}
The fields above is same as what should be defined in UI.
secretis the webhook secret which you should have defined in GitLab.usernameis the QuickBuild user (username here) to trigger the build who should at least haveRUN_BUILDpermission for this configuration.conditionis an optional field which are some Groovy scripts to tell QuickBuild on which condition the build should be triggered.variablesis a list of build variables. Each variable should containnameand itsvalue, all should be string type.
Delete GitLab Webhook Configuration Settings
DELETE /rest/webhook/gitlab/configuration_settings/{configurationId}
replace configurationId to the actual id of the configuration you want.