Skip to content

Can't disable project services trigger or unset defined channel name via API

Using GitLab Community Edition 8.11.6 i am using the API to configure Slack service details for various projects using the below curl command to test with.

WEBHOOK_URL="https://hooks.slack.com/services/xxxxxx"
SLACK_CHANNEL="#testtest"
curl -X POST -H "Content-Type:application/json" --header "PRIVATE-TOKEN: xxxxxxxxxxxxxxxxx" "https://gitlab/api/v3/projects/3200/services/slack" -d "{ \"webhook\": \"$WEBHOOK_URL\", \"merge_request_channel\": \"$SLACK_CHANNEL\" }"

This works fine to set the webhook url and channel names but i can't find a way to disable a service trigger that's not required. For example by default all triggers are enabled but if i don't need Confidential issue or Merge request triggers then how to disable them via API ? I tried to set their value to 0 or false but that doesn't do anything.

e.g.

#Try to unset the channel name
curl -X POST -H "Content-Type:application/json" --header "PRIVATE-TOKEN: xxxxxxxxxxxxxxxxx" "https://gitlab/api/v3/projects/3200/services/slack" -d "{ \"merge_request_channel\":  \" \" }"

#Try to disable trigger
curl -X POST -H "Content-Type:application/json" --header "PRIVATE-TOKEN: xxxxxxxxxxxxxxxxx" "https://gitlab/api/v3/projects/3200/services/slack" -d "{ \"merge_requests_events\": 0 }"

Can i have some guidance please how i should go about this please ?