Just as we can manage Jenkins with CLI, we can converniently interact with our gitlab server through its API.

When you have many microservices that needs CI which auto-triggers on git events, you might need webhooks configured for each project, may be even multiple hooks for the same project.

In case of Jenkins the gitlab plugin provides the webhook url for each pipeline we create.

We can avoid manually configuring webhooks each time a new pipeline is created if we use the API. Just provide the webhook url, authentication token and events that should trigger the hook and you are all set.

Sample commands for configuring and managing hooks

# payload for configuring triggers on push/merge events with the webhook url from gitlab plugin

namespaced_path_of_repo="cshintov%2Fdemo-app" # url-encoded

# Creating a hook
curl -d $payload \

# Updating a hook
curl -XPUT -d $payload \

# deleting a hook
curl -XDELETE \


For additional info please refer