Commit 0398c12b authored by Oghenerukevwe Kofi's avatar Oghenerukevwe Kofi Committed by Markus Koller

Mount services REST endpoints as integrations endpoints

As part of the effort to rename "services" to "integrations" throughout
the codebase, this duplicates the REST API routes so that it is available
under both the `/services` and `/integrations` endpoints.

Changelog: changed
Co-authored-by: default avatarAndy Soiron <asoiron@gitlab.com>
Co-authored-by: default avatarLuke Duncalfe <lduncalfe@gitlab.com>
Co-authored-by: default avatarMarkus Koller <mkoller@gitlab.com>
parent 933c35c6
......@@ -42,6 +42,7 @@ The following API resources are available in the project context:
| [Events](events.md) | `/projects/:id/events` (also available for users and standalone) |
| [Feature Flags](feature_flags.md) | `/projects/:id/feature_flags` |
| [Feature Flag User Lists](feature_flag_user_lists.md) | `/projects/:id/feature_flags_user_lists` |
| [Integrations](integrations.md) | `/projects/:id/integrations` |
| [Invitations](invitations.md) | `/projects/:id/invitations` (also available for groups) |
| [Issues](issues.md) | `/projects/:id/issues` (also available for groups and standalone) |
| [Issues Statistics](issues_statistics.md) | `/projects/:id/issues_statistics` (also available for groups and standalone) |
......@@ -82,7 +83,7 @@ The following API resources are available in the project context:
| [Resource label events](resource_label_events.md) | `/projects/:id/issues/.../resource_label_events`, `/projects/:id/merge_requests/.../resource_label_events` (also available for groups) |
| [Runners](runners.md) | `/projects/:id/runners` (also available standalone) |
| [Search](search.md) | `/projects/:id/search` (also available for groups and standalone) |
| [Services](services.md) | `/projects/:id/services` |
| [Services](services.md) (renamed to [Integrations](integrations.md)) | `/projects/:id/services` |
| [Tags](tags.md) | `/projects/:id/repository/tags` |
| [User-starred metrics dashboards](metrics_user_starred_dashboards.md ) | `/projects/:id/metrics/user_starred_dashboards` |
| [Visual Review discussions](visual_review_discussions.md) **(PREMIUM)** | `/projects/:id/merge_requests/:merge_request_id/visual_review_discussions` |
......
---
stage: Ecosystem
group: Integrations
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Integrations API **(FREE)**
This API enables you to work with external services that integrate with GitLab.
NOTE:
In GitLab 14.4, the `services` endpoint was [renamed](https://gitlab.com/gitlab-org/gitlab/-/issues/334500) to `integrations`.
Calls to the Integrations API can be made to both `/projects/:id/services` and `/projects/:id/integrations`.
The examples in this document refer to the endpoint at `/projects/:id/integrations`.
This API requires an access token with the [Maintainer or Owner role](../user/permissions.md).
## List all active integrations
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/21330) in GitLab 12.7.
Get a list of all active project integrations.
```plaintext
GET /projects/:id/integrations
```
Example response:
```json
[
{
"id": 75,
"title": "Jenkins CI",
"slug": "jenkins",
"created_at": "2019-11-20T11:20:25.297Z",
"updated_at": "2019-11-20T12:24:37.498Z",
"active": true,
"commit_events": true,
"push_events": true,
"issues_events": true,
"confidential_issues_events": true,
"merge_requests_events": true,
"tag_push_events": false,
"note_events": true,
"confidential_note_events": true,
"pipeline_events": true,
"wiki_page_events": true,
"job_events": true,
"comment_on_event_enabled": true
},
{
"id": 76,
"title": "Alerts endpoint",
"slug": "alerts",
"created_at": "2019-11-20T11:20:25.297Z",
"updated_at": "2019-11-20T12:24:37.498Z",
"active": true,
"commit_events": true,
"push_events": true,
"issues_events": true,
"confidential_issues_events": true,
"merge_requests_events": true,
"tag_push_events": true,
"note_events": true,
"confidential_note_events": true,
"pipeline_events": true,
"wiki_page_events": true,
"job_events": true,
"comment_on_event_enabled": true
}
]
```
## Asana
Add commit messages as comments to Asana tasks.
See also the [Asana integration documentation](../user/project/integrations/asana.md).
### Create/Edit Asana integration
Set Asana integration for a project.
```plaintext
PUT /projects/:id/integrations/asana
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `api_key` | string | true | User API token. User must have access to task. All comments are attributed to this user. |
| `restrict_to_branch` | string | false | Comma-separated list of branches to be are automatically inspected. Leave blank to include all branches. |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Asana integration
Delete Asana integration for a project.
```plaintext
DELETE /projects/:id/integrations/asana
```
### Get Asana integration settings
Get Asana integration settings for a project.
```plaintext
GET /projects/:id/integrations/asana
```
## Assembla
Project Management Software (Source Commits Endpoint)
### Create/Edit Assembla integration
Set Assembla integration for a project.
```plaintext
PUT /projects/:id/integrations/assembla
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | true | The authentication token
| `subdomain` | string | false | The subdomain setting |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Assembla integration
Delete Assembla integration for a project.
```plaintext
DELETE /projects/:id/integrations/assembla
```
### Get Assembla integration settings
Get Assembla integration settings for a project.
```plaintext
GET /projects/:id/integrations/assembla
```
## Atlassian Bamboo CI
A continuous integration and build server
### Create/Edit Atlassian Bamboo CI integration
Set Atlassian Bamboo CI integration for a project.
> You must set up automatic revision labeling and a repository trigger in Bamboo.
```plaintext
PUT /projects/:id/integrations/bamboo
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `bamboo_url` | string | true | Bamboo root URL. For example, `https://bamboo.example.com`. |
| `build_key` | string | true | Bamboo build plan key like KEY |
| `username` | string | true | A user with API access, if applicable |
| `password` | string | true | Password of the user |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Atlassian Bamboo CI integration
Delete Atlassian Bamboo CI integration for a project.
```plaintext
DELETE /projects/:id/integrations/bamboo
```
### Get Atlassian Bamboo CI integration settings
Get Atlassian Bamboo CI integration settings for a project.
```plaintext
GET /projects/:id/integrations/bamboo
```
## Bugzilla
Bugzilla Issue Tracker
### Create/Edit Bugzilla integration
Set Bugzilla integration for a project.
```plaintext
PUT /projects/:id/integrations/bugzilla
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `new_issue_url` | string | true | New Issue URL |
| `issues_url` | string | true | Issue URL |
| `project_url` | string | true | Project URL |
| `description` | string | false | Description |
| `title` | string | false | Title |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Bugzilla integration
Delete Bugzilla integration for a project.
```plaintext
DELETE /projects/:id/integrations/bugzilla
```
### Get Bugzilla integration settings
Get Bugzilla integration settings for a project.
```plaintext
GET /projects/:id/integrations/bugzilla
```
## Buildkite
Continuous integration and deployments
### Create/Edit Buildkite integration
Set Buildkite integration for a project.
```plaintext
PUT /projects/:id/integrations/buildkite
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | true | Buildkite project GitLab token |
| `project_url` | string | true | Pipeline URL. For example, `https://buildkite.com/example/pipeline` |
| `enable_ssl_verification` | boolean | false | DEPRECATED: This parameter has no effect since SSL verification is always enabled |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Buildkite integration
Delete Buildkite integration for a project.
```plaintext
DELETE /projects/:id/integrations/buildkite
```
### Get Buildkite integration settings
Get Buildkite integration settings for a project.
```plaintext
GET /projects/:id/integrations/buildkite
```
## Campfire
Send notifications about push events to Campfire chat rooms.
[New users can no longer sign up for Campfire](https://basecamp.com/retired/campfire).
### Create/Edit Campfire integration
Set Campfire integration for a project.
```plaintext
PUT /projects/:id/integrations/campfire
```
Parameters:
| Parameter | Type | Required | Description |
|---------------|---------|----------|---------------------------------------------------------------------------------------------|
| `token` | string | true | Campfire API token. To find it, log into Campfire and select **My info**. |
| `subdomain` | string | false | Campfire subdomain. Text between `https://` and `.campfirenow.com` when you're logged in. |
| `room` | string | false | Campfire room. The last part of the URL when you're in a room. |
| `push_events` | boolean | false | Enable notifications for push events. |
### Delete Campfire integration
Delete Campfire integration for a project.
```plaintext
DELETE /projects/:id/integrations/campfire
```
### Get Campfire integration settings
Get Campfire integration settings for a project.
```plaintext
GET /projects/:id/integrations/campfire
```
## Unify Circuit
Unify Circuit RTC and collaboration tool.
### Create/Edit Unify Circuit integration
Set Unify Circuit integration for a project.
```plaintext
PUT /projects/:id/integrations/unify-circuit
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `webhook` | string | true | The Unify Circuit webhook. For example, `https://circuit.com/rest/v2/webhooks/incoming/...`. |
| `notify_only_broken_pipelines` | boolean | false | Send notifications for broken pipelines |
| `branches_to_be_notified` | string | false | Branches to send notifications for. Valid options are "all", "default", "protected", and "default_and_protected". The default value is "default" |
| `push_events` | boolean | false | Enable notifications for push events |
| `issues_events` | boolean | false | Enable notifications for issue events |
| `confidential_issues_events` | boolean | false | Enable notifications for confidential issue events |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
| `note_events` | boolean | false | Enable notifications for note events |
| `confidential_note_events` | boolean | false | Enable notifications for confidential note events |
| `pipeline_events` | boolean | false | Enable notifications for pipeline events |
| `wiki_page_events` | boolean | false | Enable notifications for wiki page events |
### Delete Unify Circuit integration
Delete Unify Circuit integration for a project.
```plaintext
DELETE /projects/:id/integrations/unify-circuit
```
### Get Unify Circuit integration settings
Get Unify Circuit integration settings for a project.
```plaintext
GET /projects/:id/integrations/unify-circuit
```
## Webex Teams
Webex Teams collaboration tool.
### Create/Edit Webex Teams integration
Set Webex Teams integration for a project.
```plaintext
PUT /projects/:id/integrations/webex-teams
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `webhook` | string | true | The Webex Teams webhook. For example, `https://api.ciscospark.com/v1/webhooks/incoming/...`. |
| `notify_only_broken_pipelines` | boolean | false | Send notifications for broken pipelines |
| `branches_to_be_notified` | string | false | Branches to send notifications for. Valid options are "all", "default", "protected", and "default_and_protected". The default value is "default" |
| `push_events` | boolean | false | Enable notifications for push events |
| `issues_events` | boolean | false | Enable notifications for issue events |
| `confidential_issues_events` | boolean | false | Enable notifications for confidential issue events |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
| `note_events` | boolean | false | Enable notifications for note events |
| `confidential_note_events` | boolean | false | Enable notifications for confidential note events |
| `pipeline_events` | boolean | false | Enable notifications for pipeline events |
| `wiki_page_events` | boolean | false | Enable notifications for wiki page events |
### Delete Webex Teams integration
Delete Webex Teams integration for a project.
```plaintext
DELETE /projects/:id/integrations/webex-teams
```
### Get Webex Teams integration settings
Get Webex Teams integration settings for a project.
```plaintext
GET /projects/:id/integrations/webex-teams
```
## Custom Issue Tracker
Custom issue tracker
### Create/Edit Custom Issue Tracker integration
Set Custom Issue Tracker integration for a project.
```plaintext
PUT /projects/:id/integrations/custom-issue-tracker
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `new_issue_url` | string | true | New Issue URL |
| `issues_url` | string | true | Issue URL |
| `project_url` | string | true | Project URL |
| `description` | string | false | Description |
| `title` | string | false | Title |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Custom Issue Tracker integration
Delete Custom Issue Tracker integration for a project.
```plaintext
DELETE /projects/:id/integrations/custom-issue-tracker
```
### Get Custom Issue Tracker integration settings
Get Custom Issue Tracker integration settings for a project.
```plaintext
GET /projects/:id/integrations/custom-issue-tracker
```
## Drone CI
Drone is a Continuous Integration platform built on Docker, written in Go
### Create/Edit Drone CI integration
Set Drone CI integration for a project.
```plaintext
PUT /projects/:id/integrations/drone-ci
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | true | Drone CI project specific token |
| `drone_url` | string | true | `http://drone.example.com` |
| `enable_ssl_verification` | boolean | false | Enable SSL verification |
| `push_events` | boolean | false | Enable notifications for push events |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
### Delete Drone CI integration
Delete Drone CI integration for a project.
```plaintext
DELETE /projects/:id/integrations/drone-ci
```
### Get Drone CI integration settings
Get Drone CI integration settings for a project.
```plaintext
GET /projects/:id/integrations/drone-ci
```
## Emails on Push
Email the commits and diff of each push to a list of recipients.
### Create/Edit Emails on Push integration
Set Emails on Push integration for a project.
```plaintext
PUT /projects/:id/integrations/emails-on-push
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `recipients` | string | true | Emails separated by whitespace |
| `disable_diffs` | boolean | false | Disable code diffs |
| `send_from_committer_email` | boolean | false | Send from committer |
| `push_events` | boolean | false | Enable notifications for push events |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
| `branches_to_be_notified` | string | false | Branches to send notifications for. Valid options are "all", "default", "protected", and "default_and_protected". Notifications are always fired for tag pushes. The default value is "all" |
### Delete Emails on Push integration
Delete Emails on Push integration for a project.
```plaintext
DELETE /projects/:id/integrations/emails-on-push
```
### Get Emails on Push integration settings
Get Emails on Push integration settings for a project.
```plaintext
GET /projects/:id/integrations/emails-on-push
```
## Confluence integration
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/220934) in GitLab 13.2.
Replaces the link to the internal wiki with a link to a Confluence Cloud Workspace.
### Create/Edit Confluence integration
Set Confluence integration for a project.
```plaintext
PUT /projects/:id/integrations/confluence
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `confluence_url` | string | true | The URL of the Confluence Cloud Workspace hosted on atlassian.net. |
### Delete Confluence integration
Delete Confluence integration for a project.
```plaintext
DELETE /projects/:id/integrations/confluence
```
### Get Confluence integration settings
Get Confluence integration settings for a project.
```plaintext
GET /projects/:id/integrations/confluence
```
## External wiki
Replaces the link to the internal wiki with a link to an external wiki.
### Create/Edit External wiki integration
Set External wiki integration for a project.
```plaintext
PUT /projects/:id/integrations/external-wiki
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `external_wiki_url` | string | true | The URL of the external wiki |
### Delete External wiki integration
Delete External wiki integration for a project.
```plaintext
DELETE /projects/:id/integrations/external-wiki
```
### Get External wiki integration settings
Get External wiki integration settings for a project.
```plaintext
GET /projects/:id/integrations/external-wiki
```
## Flowdock
Flowdock is a ChatOps application for collaboration in software engineering
companies. You can send notifications from GitLab events to Flowdock flows.
For integration instructions, see the [Flowdock documentation](https://www.flowdock.com/help/gitlab).
### Create/Edit Flowdock integration
Set Flowdock integration for a project.
```plaintext
PUT /projects/:id/integrations/flowdock
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | true | Flowdock Git source token |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Flowdock integration
Delete Flowdock integration for a project.
```plaintext
DELETE /projects/:id/integrations/flowdock
```
### Get Flowdock integration settings
Get Flowdock integration settings for a project.
```plaintext
GET /projects/:id/integrations/flowdock
```
## GitHub **(PREMIUM)**
Code collaboration software.
### Create/Edit GitHub integration
Set GitHub integration for a project.
```plaintext
PUT /projects/:id/integrations/github
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | true | GitHub API token with `repo:status` OAuth scope |
| `repository_url` | string | true | GitHub repository URL |
| `static_context` | boolean | false | Append instance name instead of branch to [status check name](../user/project/integrations/github.md#static--dynamic-status-check-names) |
### Delete GitHub integration
Delete GitHub integration for a project.
```plaintext
DELETE /projects/:id/integrations/github
```
### Get GitHub integration settings
Get GitHub integration settings for a project.
```plaintext
GET /projects/:id/integrations/github
```
## Hangouts Chat
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/20290) in GitLab 11.2.
Google Workspace team collaboration tool.
### Create/Edit Hangouts Chat integration
Set Hangouts Chat integration for a project.
```plaintext
PUT /projects/:id/integrations/hangouts-chat
```
NOTE:
Specific event parameters (for example, `push_events` flag) were [introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/11435) in GitLab 10.4.
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `webhook` | string | true | The Hangouts Chat webhook. For example, `https://chat.googleapis.com/v1/spaces...`. |
| `notify_only_broken_pipelines` | boolean | false | Send notifications for broken pipelines |
| `notify_only_default_branch` | boolean | false | DEPRECATED: This parameter has been replaced with `branches_to_be_notified` |
| `branches_to_be_notified` | string | false | Branches to send notifications for. Valid options are "all", "default", "protected", and "default_and_protected". The default value is "default" |
| `push_events` | boolean | false | Enable notifications for push events |
| `issues_events` | boolean | false | Enable notifications for issue events |
| `confidential_issues_events` | boolean | false | Enable notifications for confidential issue events |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
| `note_events` | boolean | false | Enable notifications for note events |
| `confidential_note_events` | boolean | false | Enable notifications for confidential note events |
| `pipeline_events` | boolean | false | Enable notifications for pipeline events |
| `wiki_page_events` | boolean | false | Enable notifications for wiki page events |
### Delete Hangouts Chat integration
Delete Hangouts Chat integration for a project.
```plaintext
DELETE /projects/:id/integrations/hangouts-chat
```
### Get Hangouts Chat integration settings
Get Hangouts Chat integration settings for a project.
```plaintext
GET /projects/:id/integrations/hangouts-chat
```
## Irker (IRC gateway)
Send IRC messages, on update, to a list of recipients through an irker gateway.
For more information, see the [irker integration documentation](../user/project/integrations/irker.md).
### Create/Edit Irker (IRC gateway) integration
Set Irker (IRC gateway) integration for a project.
```plaintext
PUT /projects/:id/integrations/irker
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `recipients` | string | true | Recipients/channels separated by whitespaces |
| `default_irc_uri` | string | false | `irc://irc.network.net:6697/` |
| `server_host` | string | false | localhost |
| `server_port` | integer | false | 6659 |
| `colorize_messages` | boolean | false | Colorize messages |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Irker (IRC gateway) integration
Delete Irker (IRC gateway) integration for a project.
```plaintext
DELETE /projects/:id/integrations/irker
```
### Get Irker (IRC gateway) integration settings
Get Irker (IRC gateway) integration settings for a project.
```plaintext
GET /projects/:id/integrations/irker
```
## Jira
Jira issue tracker.
### Get Jira integration settings
Get Jira integration settings for a project.
```plaintext
GET /projects/:id/integrations/jira
```
### Create/Edit Jira integration
Set Jira integration for a project.
> Starting with GitLab 8.14, `api_url`, `issues_url`, `new_issue_url` and
> `project_url` are replaced by `url`. If you are using an
> older version, [follow this documentation](https://gitlab.com/gitlab-org/gitlab/-/blob/8-13-stable-ee/doc/api/services.md#jira).
```plaintext
PUT /projects/:id/integrations/jira
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `url` | string | yes | The URL to the Jira project which is being linked to this GitLab project. For example, `https://jira.example.com`. |
| `api_url` | string | no | The base URL to the Jira instance API. Web URL value is used if not set. For example, `https://jira-api.example.com`. |
| `username` | string | yes | The username of the user created to be used with GitLab/Jira. |
| `password` | string | yes | The password of the user created to be used with GitLab/Jira. |
| `active` | boolean | no | Activates or deactivates the integration. Defaults to false (deactivated). |
| `jira_issue_transition_automatic` | boolean | no | Enable [automatic issue transitions](../integration/jira/issues.md#automatic-issue-transitions). Takes precedence over `jira_issue_transition_id` if enabled. Defaults to `false` |
| `jira_issue_transition_id` | string | no | The ID of one or more transitions for [custom issue transitions](../integration/jira/issues.md#custom-issue-transitions). Ignored if `jira_issue_transition_automatic` is enabled. Defaults to a blank string, which disables custom transitions. |
| `commit_events` | boolean | false | Enable notifications for commit events |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `comment_on_event_enabled` | boolean | false | Enable comments inside Jira issues on each GitLab event (commit / merge request) |
### Delete Jira integration
Remove all previously Jira integrations from a project.
```plaintext
DELETE /projects/:id/integrations/jira
```
## Slack Slash Commands
Ability to receive slash commands from a Slack chat instance.
### Get Slack Slash Command integration settings
Get Slack Slash Command integration settings for a project.
```plaintext
GET /projects/:id/integrations/slack-slash-commands
```
Example response:
```json
{
"id": 4,
"title": "Slack slash commands",
"slug": "slack-slash-commands",
"created_at": "2017-06-27T05:51:39-07:00",
"updated_at": "2017-06-27T05:51:39-07:00",
"active": true,
"push_events": true,
"issues_events": true,
"confidential_issues_events": true,
"merge_requests_events": true,
"tag_push_events": true,
"note_events": true,
"job_events": true,
"pipeline_events": true,
"comment_on_event_enabled": false,
"properties": {
"token": "<your_access_token>"
}
}
```
### Create/Edit Slack Slash Commands integration
Set Slack Slash Command for a project.
```plaintext
PUT /projects/:id/integrations/slack-slash-commands
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | yes | The Slack token |
### Delete Slack Slash Command integration
Delete Slack Slash Command integration for a project.
```plaintext
DELETE /projects/:id/integrations/slack-slash-commands
```
## Mattermost Slash Commands
Ability to receive slash commands from a Mattermost chat instance.
### Get Mattermost Slash Command integration settings
Get Mattermost Slash Command integration settings for a project.
```plaintext
GET /projects/:id/integrations/mattermost-slash-commands
```
### Create/Edit Mattermost Slash Command integration
Set Mattermost Slash Command for a project.
```plaintext
PUT /projects/:id/integrations/mattermost-slash-commands
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | yes | The Mattermost token |
| `username` | string | no | The username to use to post the message |
### Delete Mattermost Slash Command integration
Delete Mattermost Slash Command integration for a project.
```plaintext
DELETE /projects/:id/integrations/mattermost-slash-commands
```
## Packagist
Update your project on Packagist (the main Composer repository) when commits or tags are pushed to GitLab.
### Create/Edit Packagist integration
Set Packagist integration for a project.
```plaintext
PUT /projects/:id/integrations/packagist
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `username` | string | yes | The username of a Packagist account |
| `token` | string | yes | API token to the Packagist server |
| `server` | boolean | no | URL of the Packagist server. Leave blank for default: <https://packagist.org> |
| `push_events` | boolean | false | Enable notifications for push events |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
### Delete Packagist integration
Delete Packagist integration for a project.
```plaintext
DELETE /projects/:id/integrations/packagist
```
### Get Packagist integration settings
Get Packagist integration settings for a project.
```plaintext
GET /projects/:id/integrations/packagist
```
## Pipeline-Emails
Get emails for GitLab CI/CD pipelines.
### Create/Edit Pipeline-Emails integration
Set Pipeline-Emails integration for a project.
```plaintext
PUT /projects/:id/integrations/pipelines-email
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `recipients` | string | yes | Comma-separated list of recipient email addresses |
| `add_pusher` | boolean | no | Add pusher to recipients list |
| `notify_only_broken_pipelines` | boolean | no | Notify only broken pipelines |
| `branches_to_be_notified` | string | false | Branches to send notifications for. Valid options are "all", "default", "protected", and "default_and_protected. The default value is "default" |
| `notify_only_default_branch` | boolean | no | Send notifications only for the default branch ([introduced in GitLab 12.0](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/28271)) |
| `pipeline_events` | boolean | false | Enable notifications for pipeline events |
### Delete Pipeline-Emails integration
Delete Pipeline-Emails integration for a project.
```plaintext
DELETE /projects/:id/integrations/pipelines-email
```
### Get Pipeline-Emails integration settings
Get Pipeline-Emails integration settings for a project.
```plaintext
GET /projects/:id/integrations/pipelines-email
```
## Pivotal Tracker
Add commit messages as comments to Pivotal Tracker stories.
See also the [Pivotal Tracker integration documentation](../user/project/integrations/pivotal_tracker.md).
### Create/Edit Pivotal Tracker integration
Set Pivotal Tracker integration for a project.
```plaintext
PUT /projects/:id/integrations/pivotaltracker
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | true | The Pivotal Tracker token |
| `restrict_to_branch` | boolean | false | Comma-separated list of branches to automatically inspect. Leave blank to include all branches. |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Pivotal Tracker integration
Delete Pivotal Tracker integration for a project.
```plaintext
DELETE /projects/:id/integrations/pivotaltracker
```
### Get Pivotal Tracker integration settings
Get Pivotal Tracker integration settings for a project.
```plaintext
GET /projects/:id/integrations/pivotaltracker
```
## Prometheus
Prometheus is a powerful time-series monitoring service.
### Create/Edit Prometheus integration
Set Prometheus integration for a project.
```plaintext
PUT /projects/:id/integrations/prometheus
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `api_url` | string | true | Prometheus API Base URL. For example, `http://prometheus.example.com/`. |
| `google_iap_audience_client_id` | string | false | Client ID of the IAP secured resource (looks like IAP_CLIENT_ID.apps.googleusercontent.com) |
| `google_iap_service_account_json` | string | false | `credentials.json` file for your service account, like { "type": "service_account", "project_id": ... } |
### Delete Prometheus integration
Delete Prometheus integration for a project.
```plaintext
DELETE /projects/:id/integrations/prometheus
```
### Get Prometheus integration settings
Get Prometheus integration settings for a project.
```plaintext
GET /projects/:id/integrations/prometheus
```
## Pushover
Pushover makes it easy to get real-time notifications on your Android device, iPhone, iPad, and Desktop.
### Create/Edit Pushover integration
Set Pushover integration for a project.
```plaintext
PUT /projects/:id/integrations/pushover
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `api_key` | string | true | Your application key |
| `user_key` | string | true | Your user key |
| `priority` | string | true | The priority |
| `device` | string | false | Leave blank for all active devices |
| `sound` | string | false | The sound of the notification |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Pushover integration
Delete Pushover integration for a project.
```plaintext
DELETE /projects/:id/integrations/pushover
```
### Get Pushover integration settings
Get Pushover integration settings for a project.
```plaintext
GET /projects/:id/integrations/pushover
```
## Redmine
Redmine issue tracker
### Create/Edit Redmine integration
Set Redmine integration for a project.
```plaintext
PUT /projects/:id/integrations/redmine
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `new_issue_url` | string | true | New Issue URL |
| `project_url` | string | true | Project URL |
| `issues_url` | string | true | Issue URL |
| `description` | string | false | Description |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Redmine integration
Delete Redmine integration for a project.
```plaintext
DELETE /projects/:id/integrations/redmine
```
### Get Redmine integration settings
Get Redmine integration settings for a project.
```plaintext
GET /projects/:id/integrations/redmine
```
## Slack notifications
Receive event notifications in Slack
### Create/Edit Slack integration
Set Slack integration for a project.
```plaintext
PUT /projects/:id/integrations/slack
```
NOTE:
Specific event parameters (for example, `push_events` flag and `push_channel`) were [introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/11435) in GitLab 10.4.
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `webhook` | string | true | `https://hooks.slack.com/services/...` |
| `username` | string | false | username |
| `channel` | string | false | Default channel to use if others are not configured |
| `notify_only_broken_pipelines` | boolean | false | Send notifications for broken pipelines |
| `notify_only_default_branch` | boolean | false | DEPRECATED: This parameter has been replaced with `branches_to_be_notified` |
| `branches_to_be_notified` | string | false | Branches to send notifications for. Valid options are "all", "default", "protected", and "default_and_protected". The default value is "default" |
| `commit_events` | boolean | false | Enable notifications for commit events |
| `confidential_issue_channel` | string | false | The name of the channel to receive confidential issues events notifications |
| `confidential_issues_events` | boolean | false | Enable notifications for confidential issue events |
| `confidential_note_channel` | string | false | The name of the channel to receive confidential note events notifications |
| `confidential_note_events` | boolean | false | Enable notifications for confidential note events |
| `deployment_channel` | string | false | The name of the channel to receive deployment events notifications |
| `deployment_events` | boolean | false | Enable notifications for deployment events |
| `issue_channel` | string | false | The name of the channel to receive issues events notifications |
| `issues_events` | boolean | false | Enable notifications for issue events |
| `job_events` | boolean | false | Enable notifications for job events |
| `merge_request_channel` | string | false | The name of the channel to receive merge request events notifications |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `note_channel` | string | false | The name of the channel to receive note events notifications |
| `note_events` | boolean | false | Enable notifications for note events |
| `pipeline_channel` | string | false | The name of the channel to receive pipeline events notifications |
| `pipeline_events` | boolean | false | Enable notifications for pipeline events |
| `push_channel` | string | false | The name of the channel to receive push events notifications |
| `push_events` | boolean | false | Enable notifications for push events |
| `tag_push_channel` | string | false | The name of the channel to receive tag push events notifications |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
| `wiki_page_channel` | string | false | The name of the channel to receive wiki page events notifications |
| `wiki_page_events` | boolean | false | Enable notifications for wiki page events |
### Delete Slack integration
Delete Slack integration for a project.
```plaintext
DELETE /projects/:id/integrations/slack
```
### Get Slack integration settings
Get Slack integration settings for a project.
```plaintext
GET /projects/:id/integrations/slack
```
## Microsoft Teams
Group Chat Software
### Create/Edit Microsoft Teams integration
Set Microsoft Teams integration for a project.
```plaintext
PUT /projects/:id/integrations/microsoft-teams
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `webhook` | string | true | The Microsoft Teams webhook. For example, `https://outlook.office.com/webhook/...` |
| `notify_only_broken_pipelines` | boolean | false | Send notifications for broken pipelines |
| `notify_only_default_branch` | boolean | false | DEPRECATED: This parameter has been replaced with `branches_to_be_notified` |
| `branches_to_be_notified` | string | false | Branches to send notifications for. Valid options are "all", "default", "protected", and "default_and_protected". The default value is "default" |
| `push_events` | boolean | false | Enable notifications for push events |
| `issues_events` | boolean | false | Enable notifications for issue events |
| `confidential_issues_events` | boolean | false | Enable notifications for confidential issue events |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
| `note_events` | boolean | false | Enable notifications for note events |
| `confidential_note_events` | boolean | false | Enable notifications for confidential note events |
| `pipeline_events` | boolean | false | Enable notifications for pipeline events |
| `wiki_page_events` | boolean | false | Enable notifications for wiki page events |
### Delete Microsoft Teams integration
Delete Microsoft Teams integration for a project.
```plaintext
DELETE /projects/:id/integrations/microsoft-teams
```
### Get Microsoft Teams integration settings
Get Microsoft Teams integration settings for a project.
```plaintext
GET /projects/:id/integrations/microsoft-teams
```
## Mattermost notifications
Receive event notifications in Mattermost
### Create/Edit Mattermost notifications integration
Set Mattermost notifications integration for a project.
```plaintext
PUT /projects/:id/integrations/mattermost
```
NOTE:
Specific event parameters (for example, `push_events` flag and `push_channel`) were [introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/11435) in GitLab 10.4.
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `webhook` | string | true | The Mattermost webhook. For example, `http://mattermost_host/hooks/...` |
| `username` | string | false | username |
| `channel` | string | false | Default channel to use if others are not configured |
| `notify_only_broken_pipelines` | boolean | false | Send notifications for broken pipelines |
| `notify_only_default_branch` | boolean | false | DEPRECATED: This parameter has been replaced with `branches_to_be_notified` |
| `branches_to_be_notified` | string | false | Branches to send notifications for. Valid options are "all", "default", "protected", and "default_and_protected". The default value is "default" |
| `push_events` | boolean | false | Enable notifications for push events |
| `issues_events` | boolean | false | Enable notifications for issue events |
| `confidential_issues_events` | boolean | false | Enable notifications for confidential issue events |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
| `note_events` | boolean | false | Enable notifications for note events |
| `confidential_note_events` | boolean | false | Enable notifications for confidential note events |
| `pipeline_events` | boolean | false | Enable notifications for pipeline events |
| `wiki_page_events` | boolean | false | Enable notifications for wiki page events |
| `push_channel` | string | false | The name of the channel to receive push events notifications |
| `issue_channel` | string | false | The name of the channel to receive issues events notifications |
| `confidential_issue_channel` | string | false | The name of the channel to receive confidential issues events notifications |
| `merge_request_channel` | string | false | The name of the channel to receive merge request events notifications |
| `note_channel` | string | false | The name of the channel to receive note events notifications |
| `confidential_note_channel` | string | false | The name of the channel to receive confidential note events notifications |
| `tag_push_channel` | string | false | The name of the channel to receive tag push events notifications |
| `pipeline_channel` | string | false | The name of the channel to receive pipeline events notifications |
| `wiki_page_channel` | string | false | The name of the channel to receive wiki page events notifications |
### Delete Mattermost notifications integration
Delete Mattermost notifications integration for a project.
```plaintext
DELETE /projects/:id/integrations/mattermost
```
### Get Mattermost notifications integration settings
Get Mattermost notifications integration settings for a project.
```plaintext
GET /projects/:id/integrations/mattermost
```
## JetBrains TeamCity CI
A continuous integration and build server
### Create/Edit JetBrains TeamCity CI integration
Set JetBrains TeamCity CI integration for a project.
> The build configuration in TeamCity must use the build format number `%build.vcs.number%`. Configure monitoring of all branches so merge requests build. That setting is in the VSC root advanced settings.
```plaintext
PUT /projects/:id/integrations/teamcity
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `teamcity_url` | string | true | TeamCity root URL. For example, `https://teamcity.example.com` |
| `build_type` | string | true | Build configuration ID |
| `username` | string | true | A user with permissions to trigger a manual build |
| `password` | string | true | The password of the user |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete JetBrains TeamCity CI integration
Delete JetBrains TeamCity CI integration for a project.
```plaintext
DELETE /projects/:id/integrations/teamcity
```
### Get JetBrains TeamCity CI integration settings
Get JetBrains TeamCity CI integration settings for a project.
```plaintext
GET /projects/:id/integrations/teamcity
```
## Jenkins CI
A continuous integration and build server
### Create/Edit Jenkins CI integration
Set Jenkins CI integration for a project.
```plaintext
PUT /projects/:id/integrations/jenkins
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `jenkins_url` | string | true | Jenkins URL like `http://jenkins.example.com`. |
| `project_name` | string | true | The URL-friendly project name. Example: `my_project_name`. |
| `username` | string | false | Username for authentication with the Jenkins server, if authentication is required by the server. |
| `password` | string | false | Password for authentication with the Jenkins server, if authentication is required by the server. |
| `push_events` | boolean | false | Enable notifications for push events. |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events. |
| `tag_push_events` | boolean | false | Enable notifications for tag push events. |
### Delete Jenkins CI integration
Delete Jenkins CI integration for a project.
```plaintext
DELETE /projects/:id/integrations/jenkins
```
### Get Jenkins CI integration settings
Get Jenkins CI integration settings for a project.
```plaintext
GET /projects/:id/integrations/jenkins
```
## Jenkins CI (Deprecated) integration
A continuous integration and build server
NOTE:
This integration was [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/1600) in GitLab 13.0.
### Create/Edit Jenkins CI (Deprecated) integration
Set Jenkins CI (Deprecated) integration for a project.
```plaintext
PUT /projects/:id/integrations/jenkins-deprecated
```
Parameters:
- `project_url` (**required**) - Jenkins project URL like `http://jenkins.example.com/job/my-project/`
- `multiproject_enabled` (optional) - Multi-project mode is configured in Jenkins GitLab Hook plugin
- `pass_unstable` (optional) - Unstable builds are treated as passing
### Delete Jenkins CI (Deprecated) integration
Delete Jenkins CI (Deprecated) integration for a project.
```plaintext
DELETE /projects/:id/integrations/jenkins-deprecated
```
### Get Jenkins CI (Deprecated) integration settings
Get Jenkins CI (Deprecated) integration settings for a project.
```plaintext
GET /projects/:id/integrations/jenkins-deprecated
```
## MockCI
Mock an external CI. See [`gitlab-org/gitlab-mock-ci-service`](https://gitlab.com/gitlab-org/gitlab-mock-ci-service) for an example of a companion mock integration.
This integration is only available when your environment is set to development.
### Create/Edit MockCI integration
Set MockCI integration for a project.
```plaintext
PUT /projects/:id/integrations/mock-ci
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `mock_service_url` | string | true | `http://localhost:4004` |
### Delete MockCI integration
Delete MockCI integration for a project.
```plaintext
DELETE /projects/:id/integrations/mock-ci
```
### Get MockCI integration settings
Get MockCI integration settings for a project.
```plaintext
GET /projects/:id/integrations/mock-ci
```
## YouTrack
YouTrack issue tracker
### Create/Edit YouTrack integration
Set YouTrack integration for a project.
```plaintext
PUT /projects/:id/integrations/youtrack
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `issues_url` | string | true | Issue URL |
| `project_url` | string | true | Project URL |
| `description` | string | false | Description |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete YouTrack integration
Delete YouTrack integration for a project.
```plaintext
DELETE /projects/:id/integrations/youtrack
```
### Get YouTrack integration settings
Get YouTrack integration settings for a project.
```plaintext
GET /projects/:id/integrations/youtrack
```
---
stage: Ecosystem
group: Integrations
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
redirect_to: 'integrations.md'
remove_date: '2021-11-09'
---
# Services API **(FREE)**
This file was moved to [another location](integrations.md).
NOTE:
This API requires an access token with the [Maintainer or Owner role](../user/permissions.md).
## List all active services
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/21330) in GitLab 12.7.
Get a list of all active project services.
```plaintext
GET /projects/:id/services
```
Example response:
```json
[
{
"id": 75,
"title": "Jenkins CI",
"slug": "jenkins",
"created_at": "2019-11-20T11:20:25.297Z",
"updated_at": "2019-11-20T12:24:37.498Z",
"active": true,
"commit_events": true,
"push_events": true,
"issues_events": true,
"confidential_issues_events": true,
"merge_requests_events": true,
"tag_push_events": false,
"note_events": true,
"confidential_note_events": true,
"pipeline_events": true,
"wiki_page_events": true,
"job_events": true,
"comment_on_event_enabled": true
},
{
"id": 76,
"title": "Alerts endpoint",
"slug": "alerts",
"created_at": "2019-11-20T11:20:25.297Z",
"updated_at": "2019-11-20T12:24:37.498Z",
"active": true,
"commit_events": true,
"push_events": true,
"issues_events": true,
"confidential_issues_events": true,
"merge_requests_events": true,
"tag_push_events": true,
"note_events": true,
"confidential_note_events": true,
"pipeline_events": true,
"wiki_page_events": true,
"job_events": true,
"comment_on_event_enabled": true
}
]
```
## Asana
Add commit messages as comments to Asana tasks.
See also the [Asana service documentation](../user/project/integrations/asana.md).
### Create/Edit Asana service
Set Asana service for a project.
```plaintext
PUT /projects/:id/services/asana
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `api_key` | string | true | User API token. User must have access to task. All comments are attributed to this user. |
| `restrict_to_branch` | string | false | Comma-separated list of branches to be are automatically inspected. Leave blank to include all branches. |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Asana service
Delete Asana service for a project.
```plaintext
DELETE /projects/:id/services/asana
```
### Get Asana service settings
Get Asana service settings for a project.
```plaintext
GET /projects/:id/services/asana
```
## Assembla
Project Management Software (Source Commits Endpoint)
### Create/Edit Assembla service
Set Assembla service for a project.
```plaintext
PUT /projects/:id/services/assembla
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | true | The authentication token
| `subdomain` | string | false | The subdomain setting |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Assembla service
Delete Assembla service for a project.
```plaintext
DELETE /projects/:id/services/assembla
```
### Get Assembla service settings
Get Assembla service settings for a project.
```plaintext
GET /projects/:id/services/assembla
```
## Atlassian Bamboo CI
A continuous integration and build server
### Create/Edit Atlassian Bamboo CI service
Set Atlassian Bamboo CI service for a project.
> You must set up automatic revision labeling and a repository trigger in Bamboo.
```plaintext
PUT /projects/:id/services/bamboo
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `bamboo_url` | string | true | Bamboo root URL. For example, `https://bamboo.example.com`. |
| `build_key` | string | true | Bamboo build plan key like KEY |
| `username` | string | true | A user with API access, if applicable |
| `password` | string | true | Password of the user |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Atlassian Bamboo CI service
Delete Atlassian Bamboo CI service for a project.
```plaintext
DELETE /projects/:id/services/bamboo
```
### Get Atlassian Bamboo CI service settings
Get Atlassian Bamboo CI service settings for a project.
```plaintext
GET /projects/:id/services/bamboo
```
## Bugzilla
Bugzilla Issue Tracker
### Create/Edit Bugzilla service
Set Bugzilla service for a project.
```plaintext
PUT /projects/:id/services/bugzilla
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `new_issue_url` | string | true | New Issue URL |
| `issues_url` | string | true | Issue URL |
| `project_url` | string | true | Project URL |
| `description` | string | false | Description |
| `title` | string | false | Title |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Bugzilla Service
Delete Bugzilla service for a project.
```plaintext
DELETE /projects/:id/services/bugzilla
```
### Get Bugzilla Service Settings
Get Bugzilla service settings for a project.
```plaintext
GET /projects/:id/services/bugzilla
```
## Buildkite
Continuous integration and deployments
### Create/Edit Buildkite service
Set Buildkite service for a project.
```plaintext
PUT /projects/:id/services/buildkite
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | true | Buildkite project GitLab token |
| `project_url` | string | true | Pipeline URL. For example, `https://buildkite.com/example/pipeline` |
| `enable_ssl_verification` | boolean | false | DEPRECATED: This parameter has no effect since SSL verification is always enabled |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Buildkite service
Delete Buildkite service for a project.
```plaintext
DELETE /projects/:id/services/buildkite
```
### Get Buildkite service settings
Get Buildkite service settings for a project.
```plaintext
GET /projects/:id/services/buildkite
```
## Campfire
Send notifications about push events to Campfire chat rooms.
[New users can no longer sign up for Campfire](https://basecamp.com/retired/campfire).
### Create/Edit Campfire service
Set Campfire service for a project.
```plaintext
PUT /projects/:id/services/campfire
```
Parameters:
| Parameter | Type | Required | Description |
|---------------|---------|----------|---------------------------------------------------------------------------------------------|
| `token` | string | true | Campfire API token. To find it, log into Campfire and select **My info**. |
| `subdomain` | string | false | Campfire subdomain. Text between `https://` and `.campfirenow.com` when you're logged in. |
| `room` | string | false | Campfire room. The last part of the URL when you're in a room. |
| `push_events` | boolean | false | Enable notifications for push events. |
### Delete Campfire service
Delete Campfire service for a project.
```plaintext
DELETE /projects/:id/services/campfire
```
### Get Campfire service settings
Get Campfire service settings for a project.
```plaintext
GET /projects/:id/services/campfire
```
## Unify Circuit
Unify Circuit RTC and collaboration tool.
### Create/Edit Unify Circuit service
Set Unify Circuit service for a project.
```plaintext
PUT /projects/:id/services/unify-circuit
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `webhook` | string | true | The Unify Circuit webhook. For example, `https://circuit.com/rest/v2/webhooks/incoming/...`. |
| `notify_only_broken_pipelines` | boolean | false | Send notifications for broken pipelines |
| `branches_to_be_notified` | string | false | Branches to send notifications for. Valid options are "all", "default", "protected", and "default_and_protected". The default value is "default" |
| `push_events` | boolean | false | Enable notifications for push events |
| `issues_events` | boolean | false | Enable notifications for issue events |
| `confidential_issues_events` | boolean | false | Enable notifications for confidential issue events |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
| `note_events` | boolean | false | Enable notifications for note events |
| `confidential_note_events` | boolean | false | Enable notifications for confidential note events |
| `pipeline_events` | boolean | false | Enable notifications for pipeline events |
| `wiki_page_events` | boolean | false | Enable notifications for wiki page events |
### Delete Unify Circuit service
Delete Unify Circuit service for a project.
```plaintext
DELETE /projects/:id/services/unify-circuit
```
### Get Unify Circuit service settings
Get Unify Circuit service settings for a project.
```plaintext
GET /projects/:id/services/unify-circuit
```
## Webex Teams
Webex Teams collaboration tool.
### Create/Edit Webex Teams service
Set Webex Teams service for a project.
```plaintext
PUT /projects/:id/services/webex-teams
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `webhook` | string | true | The Webex Teams webhook. For example, `https://api.ciscospark.com/v1/webhooks/incoming/...`. |
| `notify_only_broken_pipelines` | boolean | false | Send notifications for broken pipelines |
| `branches_to_be_notified` | string | false | Branches to send notifications for. Valid options are "all", "default", "protected", and "default_and_protected". The default value is "default" |
| `push_events` | boolean | false | Enable notifications for push events |
| `issues_events` | boolean | false | Enable notifications for issue events |
| `confidential_issues_events` | boolean | false | Enable notifications for confidential issue events |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
| `note_events` | boolean | false | Enable notifications for note events |
| `confidential_note_events` | boolean | false | Enable notifications for confidential note events |
| `pipeline_events` | boolean | false | Enable notifications for pipeline events |
| `wiki_page_events` | boolean | false | Enable notifications for wiki page events |
### Delete Webex Teams service
Delete Webex Teams service for a project.
```plaintext
DELETE /projects/:id/services/webex-teams
```
### Get Webex Teams service settings
Get Webex Teams service settings for a project.
```plaintext
GET /projects/:id/services/webex-teams
```
## Custom Issue Tracker
Custom issue tracker
### Create/Edit Custom Issue Tracker service
Set Custom Issue Tracker service for a project.
```plaintext
PUT /projects/:id/services/custom-issue-tracker
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `new_issue_url` | string | true | New Issue URL |
| `issues_url` | string | true | Issue URL |
| `project_url` | string | true | Project URL |
| `description` | string | false | Description |
| `title` | string | false | Title |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Custom Issue Tracker service
Delete Custom Issue Tracker service for a project.
```plaintext
DELETE /projects/:id/services/custom-issue-tracker
```
### Get Custom Issue Tracker service settings
Get Custom Issue Tracker service settings for a project.
```plaintext
GET /projects/:id/services/custom-issue-tracker
```
## Drone CI
Drone is a Continuous Integration platform built on Docker, written in Go
### Create/Edit Drone CI service
Set Drone CI service for a project.
```plaintext
PUT /projects/:id/services/drone-ci
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | true | Drone CI project specific token |
| `drone_url` | string | true | `http://drone.example.com` |
| `enable_ssl_verification` | boolean | false | Enable SSL verification |
| `push_events` | boolean | false | Enable notifications for push events |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
### Delete Drone CI service
Delete Drone CI service for a project.
```plaintext
DELETE /projects/:id/services/drone-ci
```
### Get Drone CI service settings
Get Drone CI service settings for a project.
```plaintext
GET /projects/:id/services/drone-ci
```
## Emails on push
Email the commits and diff of each push to a list of recipients.
### Create/Edit Emails on push service
Set Emails on push service for a project.
```plaintext
PUT /projects/:id/services/emails-on-push
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `recipients` | string | true | Emails separated by whitespace |
| `disable_diffs` | boolean | false | Disable code diffs |
| `send_from_committer_email` | boolean | false | Send from committer |
| `push_events` | boolean | false | Enable notifications for push events |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
| `branches_to_be_notified` | string | false | Branches to send notifications for. Valid options are "all", "default", "protected", and "default_and_protected". Notifications are always fired for tag pushes. The default value is "all" |
### Delete Emails on push service
Delete Emails on push service for a project.
```plaintext
DELETE /projects/:id/services/emails-on-push
```
### Get Emails on push service settings
Get Emails on push service settings for a project.
```plaintext
GET /projects/:id/services/emails-on-push
```
## Confluence service
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/220934) in GitLab 13.2.
Replaces the link to the internal wiki with a link to a Confluence Cloud Workspace.
### Create/Edit Confluence service
Set Confluence service for a project.
```plaintext
PUT /projects/:id/services/confluence
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `confluence_url` | string | true | The URL of the Confluence Cloud Workspace hosted on atlassian.net. |
### Delete Confluence service
Delete Confluence service for a project.
```plaintext
DELETE /projects/:id/services/confluence
```
### Get Confluence service settings
Get Confluence service settings for a project.
```plaintext
GET /projects/:id/services/confluence
```
## External wiki
Replaces the link to the internal wiki with a link to an external wiki.
### Create/Edit External wiki service
Set External wiki service for a project.
```plaintext
PUT /projects/:id/services/external-wiki
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `external_wiki_url` | string | true | The URL of the external wiki |
### Delete External wiki service
Delete External wiki service for a project.
```plaintext
DELETE /projects/:id/services/external-wiki
```
### Get External wiki service settings
Get External wiki service settings for a project.
```plaintext
GET /projects/:id/services/external-wiki
```
## Flowdock
Flowdock is a ChatOps application for collaboration in software engineering
companies. You can send notifications from GitLab events to Flowdock flows.
For integration instructions, see the [Flowdock documentation](https://www.flowdock.com/help/gitlab).
### Create/Edit Flowdock service
Set Flowdock service for a project.
```plaintext
PUT /projects/:id/services/flowdock
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | true | Flowdock Git source token |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Flowdock service
Delete Flowdock service for a project.
```plaintext
DELETE /projects/:id/services/flowdock
```
### Get Flowdock service settings
Get Flowdock service settings for a project.
```plaintext
GET /projects/:id/services/flowdock
```
## GitHub **(PREMIUM)**
Code collaboration software.
### Create/Edit GitHub service
Set GitHub service for a project.
```plaintext
PUT /projects/:id/services/github
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | true | GitHub API token with `repo:status` OAuth scope |
| `repository_url` | string | true | GitHub repository URL |
| `static_context` | boolean | false | Append instance name instead of branch to [status check name](../user/project/integrations/github.md#static--dynamic-status-check-names) |
### Delete GitHub service
Delete GitHub service for a project.
```plaintext
DELETE /projects/:id/services/github
```
### Get GitHub service settings
Get GitHub service settings for a project.
```plaintext
GET /projects/:id/services/github
```
## Hangouts Chat
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/20290) in GitLab 11.2.
Google Workspace team collaboration tool.
### Create/Edit Hangouts Chat service
Set Hangouts Chat service for a project.
```plaintext
PUT /projects/:id/services/hangouts-chat
```
NOTE:
Specific event parameters (for example, `push_events` flag) were [introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/11435) in GitLab 10.4.
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `webhook` | string | true | The Hangouts Chat webhook. For example, `https://chat.googleapis.com/v1/spaces...`. |
| `notify_only_broken_pipelines` | boolean | false | Send notifications for broken pipelines |
| `notify_only_default_branch` | boolean | false | DEPRECATED: This parameter has been replaced with `branches_to_be_notified` |
| `branches_to_be_notified` | string | false | Branches to send notifications for. Valid options are "all", "default", "protected", and "default_and_protected". The default value is "default" |
| `push_events` | boolean | false | Enable notifications for push events |
| `issues_events` | boolean | false | Enable notifications for issue events |
| `confidential_issues_events` | boolean | false | Enable notifications for confidential issue events |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
| `note_events` | boolean | false | Enable notifications for note events |
| `confidential_note_events` | boolean | false | Enable notifications for confidential note events |
| `pipeline_events` | boolean | false | Enable notifications for pipeline events |
| `wiki_page_events` | boolean | false | Enable notifications for wiki page events |
### Delete Hangouts Chat service
Delete Hangouts Chat service for a project.
```plaintext
DELETE /projects/:id/services/hangouts-chat
```
### Get Hangouts Chat service settings
Get Hangouts Chat service settings for a project.
```plaintext
GET /projects/:id/services/hangouts-chat
```
## irker (IRC gateway)
Send IRC messages, on update, to a list of recipients through an irker gateway.
For more information, see the [irker integration documentation](../user/project/integrations/irker.md).
### Create/Edit irker (IRC gateway) service
Set irker (IRC gateway) service for a project.
```plaintext
PUT /projects/:id/services/irker
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `recipients` | string | true | Recipients/channels separated by whitespaces |
| `default_irc_uri` | string | false | `irc://irc.network.net:6697/` |
| `server_host` | string | false | localhost |
| `server_port` | integer | false | 6659 |
| `colorize_messages` | boolean | false | Colorize messages |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete irker (IRC gateway) service
Delete irker (IRC gateway) service for a project.
```plaintext
DELETE /projects/:id/services/irker
```
### Get irker (IRC gateway) service settings
Get irker (IRC gateway) service settings for a project.
```plaintext
GET /projects/:id/services/irker
```
## Jira
Jira issue tracker.
### Get Jira service settings
Get Jira service settings for a project.
```plaintext
GET /projects/:id/services/jira
```
### Create/Edit Jira service
Set Jira service for a project.
> Starting with GitLab 8.14, `api_url`, `issues_url`, `new_issue_url` and
> `project_url` are replaced by `url`. If you are using an
> older version, [follow this documentation](https://gitlab.com/gitlab-org/gitlab/-/blob/8-13-stable-ee/doc/api/services.md#jira).
```plaintext
PUT /projects/:id/services/jira
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `url` | string | yes | The URL to the Jira project which is being linked to this GitLab project. For example, `https://jira.example.com`. |
| `api_url` | string | no | The base URL to the Jira instance API. Web URL value is used if not set. For example, `https://jira-api.example.com`. |
| `username` | string | yes | The username of the user created to be used with GitLab/Jira. |
| `password` | string | yes | The password of the user created to be used with GitLab/Jira. |
| `active` | boolean | no | Activates or deactivates the service. Defaults to false (deactivated). |
| `jira_issue_transition_automatic` | boolean | no | Enable [automatic issue transitions](../integration/jira/issues.md#automatic-issue-transitions). Takes precedence over `jira_issue_transition_id` if enabled. Defaults to `false` |
| `jira_issue_transition_id` | string | no | The ID of one or more transitions for [custom issue transitions](../integration/jira/issues.md#custom-issue-transitions). Ignored if `jira_issue_transition_automatic` is enabled. Defaults to a blank string, which disables custom transitions. |
| `commit_events` | boolean | false | Enable notifications for commit events |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `comment_on_event_enabled` | boolean | false | Enable comments inside Jira issues on each GitLab event (commit / merge request) |
### Delete Jira service
Remove all previously Jira settings from a project.
```plaintext
DELETE /projects/:id/services/jira
```
## Slack slash commands
Ability to receive slash commands from a Slack chat instance.
### Get Slack slash command service settings
Get Slack slash command service settings for a project.
```plaintext
GET /projects/:id/services/slack-slash-commands
```
Example response:
```json
{
"id": 4,
"title": "Slack slash commands",
"slug": "slack-slash-commands",
"created_at": "2017-06-27T05:51:39-07:00",
"updated_at": "2017-06-27T05:51:39-07:00",
"active": true,
"push_events": true,
"issues_events": true,
"confidential_issues_events": true,
"merge_requests_events": true,
"tag_push_events": true,
"note_events": true,
"job_events": true,
"pipeline_events": true,
"comment_on_event_enabled": false,
"properties": {
"token": "<your_access_token>"
}
}
```
### Create/Edit Slack slash command service
Set Slack slash command for a project.
```plaintext
PUT /projects/:id/services/slack-slash-commands
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | yes | The Slack token |
### Delete Slack slash command service
Delete Slack slash command service for a project.
```plaintext
DELETE /projects/:id/services/slack-slash-commands
```
## Mattermost slash commands
Ability to receive slash commands from a Mattermost chat instance.
### Get Mattermost slash command service settings
Get Mattermost slash command service settings for a project.
```plaintext
GET /projects/:id/services/mattermost-slash-commands
```
### Create/Edit Mattermost slash command service
Set Mattermost slash command for a project.
```plaintext
PUT /projects/:id/services/mattermost-slash-commands
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | yes | The Mattermost token |
| `username` | string | no | The username to use to post the message |
### Delete Mattermost slash command service
Delete Mattermost slash command service for a project.
```plaintext
DELETE /projects/:id/services/mattermost-slash-commands
```
## Packagist
Update your project on Packagist (the main Composer repository) when commits or tags are pushed to GitLab.
### Create/Edit Packagist service
Set Packagist service for a project.
```plaintext
PUT /projects/:id/services/packagist
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `username` | string | yes | The username of a Packagist account |
| `token` | string | yes | API token to the Packagist server |
| `server` | boolean | no | URL of the Packagist server. Leave blank for default: <https://packagist.org> |
| `push_events` | boolean | false | Enable notifications for push events |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
### Delete Packagist service
Delete Packagist service for a project.
```plaintext
DELETE /projects/:id/services/packagist
```
### Get Packagist service settings
Get Packagist service settings for a project.
```plaintext
GET /projects/:id/services/packagist
```
## Pipeline-Emails
Get emails for GitLab CI/CD pipelines.
### Create/Edit Pipeline-Emails service
Set Pipeline-Emails service for a project.
```plaintext
PUT /projects/:id/services/pipelines-email
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `recipients` | string | yes | Comma-separated list of recipient email addresses |
| `add_pusher` | boolean | no | Add pusher to recipients list |
| `notify_only_broken_pipelines` | boolean | no | Notify only broken pipelines |
| `branches_to_be_notified` | string | false | Branches to send notifications for. Valid options are "all", "default", "protected", and "default_and_protected. The default value is "default" |
| `notify_only_default_branch` | boolean | no | Send notifications only for the default branch ([introduced in GitLab 12.0](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/28271)) |
| `pipeline_events` | boolean | false | Enable notifications for pipeline events |
### Delete Pipeline-Emails service
Delete Pipeline-Emails service for a project.
```plaintext
DELETE /projects/:id/services/pipelines-email
```
### Get Pipeline-Emails service settings
Get Pipeline-Emails service settings for a project.
```plaintext
GET /projects/:id/services/pipelines-email
```
## Pivotal Tracker
Add commit messages as comments to Pivotal Tracker stories.
See also the [Pivotal Tracker service documentation](../user/project/integrations/pivotal_tracker.md).
### Create/Edit Pivotal Tracker service
Set Pivotal Tracker service for a project.
```plaintext
PUT /projects/:id/services/pivotaltracker
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | true | The Pivotal Tracker token |
| `restrict_to_branch` | boolean | false | Comma-separated list of branches to automatically inspect. Leave blank to include all branches. |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Pivotal Tracker service
Delete Pivotal Tracker service for a project.
```plaintext
DELETE /projects/:id/services/pivotaltracker
```
### Get Pivotal Tracker service settings
Get Pivotal Tracker service settings for a project.
```plaintext
GET /projects/:id/services/pivotaltracker
```
## Prometheus
Prometheus is a powerful time-series monitoring service.
### Create/Edit Prometheus service
Set Prometheus service for a project.
```plaintext
PUT /projects/:id/services/prometheus
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `api_url` | string | true | Prometheus API Base URL. For example, `http://prometheus.example.com/`. |
| `google_iap_audience_client_id` | string | false | Client ID of the IAP secured resource (looks like IAP_CLIENT_ID.apps.googleusercontent.com) |
| `google_iap_service_account_json` | string | false | `credentials.json` file for your service account, like { "type": "service_account", "project_id": ... } |
### Delete Prometheus service
Delete Prometheus service for a project.
```plaintext
DELETE /projects/:id/services/prometheus
```
### Get Prometheus service settings
Get Prometheus service settings for a project.
```plaintext
GET /projects/:id/services/prometheus
```
## Pushover
Pushover makes it easy to get real-time notifications on your Android device, iPhone, iPad, and Desktop.
### Create/Edit Pushover service
Set Pushover service for a project.
```plaintext
PUT /projects/:id/services/pushover
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `api_key` | string | true | Your application key |
| `user_key` | string | true | Your user key |
| `priority` | string | true | The priority |
| `device` | string | false | Leave blank for all active devices |
| `sound` | string | false | The sound of the notification |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Pushover service
Delete Pushover service for a project.
```plaintext
DELETE /projects/:id/services/pushover
```
### Get Pushover service settings
Get Pushover service settings for a project.
```plaintext
GET /projects/:id/services/pushover
```
## Redmine
Redmine issue tracker
### Create/Edit Redmine service
Set Redmine service for a project.
```plaintext
PUT /projects/:id/services/redmine
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `new_issue_url` | string | true | New Issue URL |
| `project_url` | string | true | Project URL |
| `issues_url` | string | true | Issue URL |
| `description` | string | false | Description |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete Redmine service
Delete Redmine service for a project.
```plaintext
DELETE /projects/:id/services/redmine
```
### Get Redmine service settings
Get Redmine service settings for a project.
```plaintext
GET /projects/:id/services/redmine
```
## Slack notifications
Receive event notifications in Slack
### Create/Edit Slack service
Set Slack service for a project.
```plaintext
PUT /projects/:id/services/slack
```
NOTE:
Specific event parameters (for example, `push_events` flag and `push_channel`) were [introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/11435) in GitLab 10.4.
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `webhook` | string | true | `https://hooks.slack.com/services/...` |
| `username` | string | false | username |
| `channel` | string | false | Default channel to use if others are not configured |
| `notify_only_broken_pipelines` | boolean | false | Send notifications for broken pipelines |
| `notify_only_default_branch` | boolean | false | DEPRECATED: This parameter has been replaced with `branches_to_be_notified` |
| `branches_to_be_notified` | string | false | Branches to send notifications for. Valid options are "all", "default", "protected", and "default_and_protected". The default value is "default" |
| `commit_events` | boolean | false | Enable notifications for commit events |
| `confidential_issue_channel` | string | false | The name of the channel to receive confidential issues events notifications |
| `confidential_issues_events` | boolean | false | Enable notifications for confidential issue events |
| `confidential_note_channel` | string | false | The name of the channel to receive confidential note events notifications |
| `confidential_note_events` | boolean | false | Enable notifications for confidential note events |
| `deployment_channel` | string | false | The name of the channel to receive deployment events notifications |
| `deployment_events` | boolean | false | Enable notifications for deployment events |
| `issue_channel` | string | false | The name of the channel to receive issues events notifications |
| `issues_events` | boolean | false | Enable notifications for issue events |
| `job_events` | boolean | false | Enable notifications for job events |
| `merge_request_channel` | string | false | The name of the channel to receive merge request events notifications |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `note_channel` | string | false | The name of the channel to receive note events notifications |
| `note_events` | boolean | false | Enable notifications for note events |
| `pipeline_channel` | string | false | The name of the channel to receive pipeline events notifications |
| `pipeline_events` | boolean | false | Enable notifications for pipeline events |
| `push_channel` | string | false | The name of the channel to receive push events notifications |
| `push_events` | boolean | false | Enable notifications for push events |
| `tag_push_channel` | string | false | The name of the channel to receive tag push events notifications |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
| `wiki_page_channel` | string | false | The name of the channel to receive wiki page events notifications |
| `wiki_page_events` | boolean | false | Enable notifications for wiki page events |
| `vulnerability_channel` | string | false | **(ULTIMATE)** The name of the channel to receive vulnerability event notifications. |
| `vulnerability_events` | boolean | false | **(ULTIMATE)** Enable notifications for vulnerability events |
### Delete Slack service
Delete Slack service for a project.
```plaintext
DELETE /projects/:id/services/slack
```
### Get Slack service settings
Get Slack service settings for a project.
```plaintext
GET /projects/:id/services/slack
```
## Microsoft Teams
Group Chat Software
### Create/Edit Microsoft Teams service
Set Microsoft Teams service for a project.
```plaintext
PUT /projects/:id/services/microsoft-teams
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `webhook` | string | true | The Microsoft Teams webhook. For example, `https://outlook.office.com/webhook/...` |
| `notify_only_broken_pipelines` | boolean | false | Send notifications for broken pipelines |
| `notify_only_default_branch` | boolean | false | DEPRECATED: This parameter has been replaced with `branches_to_be_notified` |
| `branches_to_be_notified` | string | false | Branches to send notifications for. Valid options are "all", "default", "protected", and "default_and_protected". The default value is "default" |
| `push_events` | boolean | false | Enable notifications for push events |
| `issues_events` | boolean | false | Enable notifications for issue events |
| `confidential_issues_events` | boolean | false | Enable notifications for confidential issue events |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
| `note_events` | boolean | false | Enable notifications for note events |
| `confidential_note_events` | boolean | false | Enable notifications for confidential note events |
| `pipeline_events` | boolean | false | Enable notifications for pipeline events |
| `wiki_page_events` | boolean | false | Enable notifications for wiki page events |
### Delete Microsoft Teams service
Delete Microsoft Teams service for a project.
```plaintext
DELETE /projects/:id/services/microsoft-teams
```
### Get Microsoft Teams service settings
Get Microsoft Teams service settings for a project.
```plaintext
GET /projects/:id/services/microsoft-teams
```
## Mattermost notifications
Receive event notifications in Mattermost
### Create/Edit Mattermost notifications service
Set Mattermost service for a project.
```plaintext
PUT /projects/:id/services/mattermost
```
NOTE:
Specific event parameters (for example, `push_events` flag and `push_channel`) were [introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/11435) in GitLab 10.4.
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `webhook` | string | true | The Mattermost webhook. For example, `http://mattermost_host/hooks/...` |
| `username` | string | false | username |
| `channel` | string | false | Default channel to use if others are not configured |
| `notify_only_broken_pipelines` | boolean | false | Send notifications for broken pipelines |
| `notify_only_default_branch` | boolean | false | DEPRECATED: This parameter has been replaced with `branches_to_be_notified` |
| `branches_to_be_notified` | string | false | Branches to send notifications for. Valid options are "all", "default", "protected", and "default_and_protected". The default value is "default" |
| `push_events` | boolean | false | Enable notifications for push events |
| `issues_events` | boolean | false | Enable notifications for issue events |
| `confidential_issues_events` | boolean | false | Enable notifications for confidential issue events |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
| `note_events` | boolean | false | Enable notifications for note events |
| `confidential_note_events` | boolean | false | Enable notifications for confidential note events |
| `pipeline_events` | boolean | false | Enable notifications for pipeline events |
| `wiki_page_events` | boolean | false | Enable notifications for wiki page events |
| `vulnerability_events` | boolean | false | **(ULTIMATE)** Enable notifications for vulnerability events |
| `push_channel` | string | false | The name of the channel to receive push events notifications |
| `issue_channel` | string | false | The name of the channel to receive issues events notifications |
| `confidential_issue_channel` | string | false | The name of the channel to receive confidential issues events notifications |
| `merge_request_channel` | string | false | The name of the channel to receive merge request events notifications |
| `note_channel` | string | false | The name of the channel to receive note events notifications |
| `confidential_note_channel` | string | false | The name of the channel to receive confidential note events notifications |
| `tag_push_channel` | string | false | The name of the channel to receive tag push events notifications |
| `pipeline_channel` | string | false | The name of the channel to receive pipeline events notifications |
| `wiki_page_channel` | string | false | The name of the channel to receive wiki page events notifications |
| `vulnerability_channel` | string | false | **(ULTIMATE)** The name of the channel to receive vulnerability events notifications |
### Delete Mattermost notifications service
Delete Mattermost Notifications service for a project.
```plaintext
DELETE /projects/:id/services/mattermost
```
### Get Mattermost notifications service settings
Get Mattermost notifications service settings for a project.
```plaintext
GET /projects/:id/services/mattermost
```
## JetBrains TeamCity CI
A continuous integration and build server
### Create/Edit JetBrains TeamCity CI service
Set JetBrains TeamCity CI service for a project.
> The build configuration in TeamCity must use the build format number `%build.vcs.number%`. Configure monitoring of all branches so merge requests build. That setting is in the VSC root advanced settings.
```plaintext
PUT /projects/:id/services/teamcity
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `teamcity_url` | string | true | TeamCity root URL. For example, `https://teamcity.example.com` |
| `build_type` | string | true | Build configuration ID |
| `username` | string | true | A user with permissions to trigger a manual build |
| `password` | string | true | The password of the user |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete JetBrains TeamCity CI service
Delete JetBrains TeamCity CI service for a project.
```plaintext
DELETE /projects/:id/services/teamcity
```
### Get JetBrains TeamCity CI service settings
Get JetBrains TeamCity CI service settings for a project.
```plaintext
GET /projects/:id/services/teamcity
```
## Jenkins CI
A continuous integration and build server
### Create/Edit Jenkins CI service
Set Jenkins CI service for a project.
```plaintext
PUT /projects/:id/services/jenkins
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `jenkins_url` | string | true | Jenkins URL like `http://jenkins.example.com`. |
| `project_name` | string | true | The URL-friendly project name. Example: `my_project_name`. |
| `username` | string | false | Username for authentication with the Jenkins server, if authentication is required by the server. |
| `password` | string | false | Password for authentication with the Jenkins server, if authentication is required by the server. |
| `push_events` | boolean | false | Enable notifications for push events. |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events. |
| `tag_push_events` | boolean | false | Enable notifications for tag push events. |
### Delete Jenkins CI service
Delete Jenkins CI service for a project.
```plaintext
DELETE /projects/:id/services/jenkins
```
### Get Jenkins CI service settings
Get Jenkins CI service settings for a project.
```plaintext
GET /projects/:id/services/jenkins
```
## Jenkins CI (Deprecated) Service
A continuous integration and build server
NOTE:
This service was [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/1600) in GitLab 13.0.
### Create/Edit Jenkins CI (Deprecated) service
Set Jenkins CI (Deprecated) service for a project.
```plaintext
PUT /projects/:id/services/jenkins-deprecated
```
Parameters:
- `project_url` (**required**) - Jenkins project URL like `http://jenkins.example.com/job/my-project/`
- `multiproject_enabled` (optional) - Multi-project mode is configured in Jenkins GitLab Hook plugin
- `pass_unstable` (optional) - Unstable builds are treated as passing
### Delete Jenkins CI (Deprecated) service
Delete Jenkins CI (Deprecated) service for a project.
```plaintext
DELETE /projects/:id/services/jenkins-deprecated
```
### Get Jenkins CI (Deprecated) service settings
Get Jenkins CI (Deprecated) service settings for a project.
```plaintext
GET /projects/:id/services/jenkins-deprecated
```
## MockCI
Mock an external CI. See [`gitlab-org/gitlab-mock-ci-service`](https://gitlab.com/gitlab-org/gitlab-mock-ci-service) for an example of a companion mock service.
This service is only available when your environment is set to development.
### Create/Edit MockCI service
Set MockCI service for a project.
```plaintext
PUT /projects/:id/services/mock-ci
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `mock_service_url` | string | true | `http://localhost:4004` |
### Delete MockCI service
Delete MockCI service for a project.
```plaintext
DELETE /projects/:id/services/mock-ci
```
### Get MockCI service settings
Get MockCI service settings for a project.
```plaintext
GET /projects/:id/services/mock-ci
```
## YouTrack
YouTrack issue tracker
### Create/Edit YouTrack service
Set YouTrack service for a project.
```plaintext
PUT /projects/:id/services/youtrack
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `issues_url` | string | true | Issue URL |
| `project_url` | string | true | Project URL |
| `description` | string | false | Description |
| `push_events` | boolean | false | Enable notifications for push events |
### Delete YouTrack Service
Delete YouTrack service for a project.
```plaintext
DELETE /projects/:id/services/youtrack
```
### Get YouTrack Service Settings
Get YouTrack service settings for a project.
```plaintext
GET /projects/:id/services/youtrack
```
<!-- This redirect file can be deleted after <2021-11-09>. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
......@@ -4,9 +4,9 @@ group: Integrations
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Asana service **(FREE)**
# Asana integration **(FREE)**
This service adds commit messages as comments to Asana tasks.
This integration adds commit messages as comments to Asana tasks.
Once enabled, commit messages are checked for Asana task URLs (for example,
`https://app.asana.com/0/123456/987654`) or task IDs starting with `#`
(for example, `#987654`). Every task ID found gets the commit comment added to it.
......@@ -23,7 +23,7 @@ You can use either of these words:
- `closed`
- `closing`
See also the [Asana service API documentation](../../../api/services.md#asana).
See also the [Asana integration API documentation](../../../api/integrations.md#asana).
## Setup
......
......@@ -32,7 +32,7 @@ Click on the service links to see further configuration instructions and details
| [Bugzilla](bugzilla.md) | Use Bugzilla as the issue tracker. | **{dotted-circle}** No |
| Buildkite | Run CI/CD pipelines with Buildkite. | **{check-circle}** Yes |
| Campfire | Connect to chat. | **{dotted-circle}** No |
| [Confluence Workspace](../../../api/services.md#confluence-service) | Replace the link to the internal wiki with a link to a Confluence Cloud Workspace. | **{dotted-circle}** No |
| [Confluence Workspace](../../../api/integrations.md#confluence-integration) | Replace the link to the internal wiki with a link to a Confluence Cloud Workspace. | **{dotted-circle}** No |
| [Custom issue tracker](custom_issue_tracker.md) | Use a custom issue tracker. | **{dotted-circle}** No |
| [Datadog](../../../integration/datadog.md) | Trace your GitLab pipelines with Datadog. | **{check-circle}** Yes |
| [Discord Notifications](discord_notifications.md) | Send notifications about project events to a Discord channel. | **{dotted-circle}** No |
......@@ -40,7 +40,7 @@ Click on the service links to see further configuration instructions and details
| [Emails on push](emails_on_push.md) | Send commits and diff of each push by email. | **{dotted-circle}** No |
| [EWM](ewm.md) | Use IBM Engineering Workflow Management as the issue tracker. | **{dotted-circle}** No |
| [External wiki](../wiki/index.md#link-an-external-wiki) | Link an external wiki. | **{dotted-circle}** No |
| [Flowdock](../../../api/services.md#flowdock) | Send notifications from GitLab to Flowdock flows. | **{dotted-circle}** No |
| [Flowdock](../../../api/integrations.md#flowdock) | Send notifications from GitLab to Flowdock flows. | **{dotted-circle}** No |
| [GitHub](github.md) | Obtain statuses for commits and pull requests. | **{dotted-circle}** No |
| [Google Chat](hangouts_chat.md) | Send notifications from your GitLab project to a room in Google Chat.| **{dotted-circle}** No |
| [irker (IRC gateway)](irker.md) | Send IRC messages. | **{dotted-circle}** No |
......
......@@ -29,7 +29,7 @@ Read more about the
[Source Commits endpoint](https://www.pivotaltracker.com/help/api/rest/v5#Source_Commits) in
the Pivotal Tracker API documentation.
See also the [Pivotal Tracker service API documentation](../../../api/services.md#pivotal-tracker).
See also the [Pivotal Tracker integration API documentation](../../../api/integrations.md#pivotal-tracker).
## Set up Pivotal Tracker
......
......@@ -28,7 +28,7 @@ module EE
{
required: false,
name: :static_context,
type: ::API::Services::Boolean,
type: ::API::Integrations::Boolean,
desc: 'Append instance name instead of branch to status check name'
}
]
......@@ -63,7 +63,7 @@ module EE
{
required: false,
name: :vulnerability_events,
type: ::API::Services::Boolean,
type: ::API::Integrations::Boolean,
desc: 'Enable notifications for vulnerability_events'
}
].freeze
......
......@@ -2,7 +2,7 @@
module EE
module API
module Services
module Integrations
extend ActiveSupport::Concern
prepended do
......
......@@ -2,7 +2,7 @@
require "spec_helper"
RSpec.describe API::Services do
RSpec.describe API::Integrations do
let_it_be(:user) { create(:user) }
let_it_be(:project) do
......
......@@ -260,7 +260,7 @@ module API
mount ::API::ResourceAccessTokens
mount ::API::RubygemPackages
mount ::API::Search
mount ::API::Services
mount ::API::Integrations
mount ::API::Settings
mount ::API::SidekiqMetrics
mount ::API::SnippetRepositoryStorageMoves
......
......@@ -2,7 +2,7 @@
module API
module Helpers
# Helpers module for API::Services
# Helpers module for API::Integrations
#
# The data structures inside this model are returned using class methods,
# allowing EE to extend them where necessary.
......
# frozen_string_literal: true
module API
class Services < ::API::Base
class Integrations < ::API::Base
feature_category :integrations
integrations = Helpers::IntegrationsHelpers.integrations
......@@ -12,7 +12,7 @@ module API
required: true,
name: :mock_service_url,
type: String,
desc: 'URL to the mock service'
desc: 'URL to the mock integration'
}
]
integrations['mock-deployment'] = []
......@@ -52,117 +52,122 @@ module API
]
}.freeze
params do
requires :id, type: String, desc: 'The ID of a project'
end
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
before { authenticate! }
before { authorize_admin_project }
helpers do
def integration_attributes(integration)
integration.fields.inject([]) do |arr, hash|
arr << hash[:name].to_sym
end
helpers do
def integration_attributes(integration)
integration.fields.inject([]) do |arr, hash|
arr << hash[:name].to_sym
end
end
end
desc 'Get all active project integrations' do
success Entities::ProjectIntegrationBasic
# The API officially documents only the `:id/integrations` API paths.
# We support the older `id:/services` path for backwards-compatibility in API V4.
# The support for `:id/services` can be dropped if we create an API V5.
[':id/services', ':id/integrations'].each do |path|
params do
requires :id, type: String, desc: 'The ID of a project'
end
get ":id/services" do
integrations = user_project.integrations.active
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
before { authenticate! }
before { authorize_admin_project }
present integrations, with: Entities::ProjectIntegrationBasic
end
desc 'Get all active project integrations' do
success Entities::ProjectIntegrationBasic
end
get path do
integrations = user_project.integrations.active
INTEGRATIONS.each do |slug, settings|
desc "Set #{slug} integration for project"
params do
settings.each do |setting|
if setting[:required]
requires setting[:name], type: setting[:type], desc: setting[:desc]
else
optional setting[:name], type: setting[:type], desc: setting[:desc]
present integrations, with: Entities::ProjectIntegrationBasic
end
INTEGRATIONS.each do |slug, settings|
desc "Set #{slug} integration for project"
params do
settings.each do |setting|
if setting[:required]
requires setting[:name], type: setting[:type], desc: setting[:desc]
else
optional setting[:name], type: setting[:type], desc: setting[:desc]
end
end
end
end
put ":id/services/#{slug}" do
integration = user_project.find_or_initialize_integration(slug.underscore)
params = declared_params(include_missing: false).merge(active: true)
if integration.update(params)
present integration, with: Entities::ProjectIntegration
else
render_api_error!('400 Bad Request', 400)
put "#{path}/#{slug}" do
integration = user_project.find_or_initialize_integration(slug.underscore)
params = declared_params(include_missing: false).merge(active: true)
if integration.update(params)
present integration, with: Entities::ProjectIntegration
else
render_api_error!('400 Bad Request', 400)
end
end
end
end
desc "Delete an integration from a project"
params do
requires :slug, type: String, values: INTEGRATIONS.keys, desc: 'The name of the service'
end
delete ":id/services/:slug" do
integration = user_project.find_or_initialize_integration(params[:slug].underscore)
desc "Delete an integration from a project"
params do
requires :slug, type: String, values: INTEGRATIONS.keys, desc: 'The name of the integration'
end
delete "#{path}/:slug" do
integration = user_project.find_or_initialize_integration(params[:slug].underscore)
destroy_conditionally!(integration) do
attrs = integration_attributes(integration).index_with { nil }.merge(active: false)
destroy_conditionally!(integration) do
attrs = integration_attributes(integration).index_with { nil }.merge(active: false)
render_api_error!('400 Bad Request', 400) unless integration.update(attrs)
render_api_error!('400 Bad Request', 400) unless integration.update(attrs)
end
end
end
desc 'Get the integration settings for a project' do
success Entities::ProjectIntegration
end
params do
requires :slug, type: String, values: INTEGRATIONS.keys, desc: 'The name of the service'
end
get ":id/services/:slug" do
integration = user_project.find_or_initialize_integration(params[:slug].underscore)
desc 'Get the integration settings for a project' do
success Entities::ProjectIntegration
end
params do
requires :slug, type: String, values: INTEGRATIONS.keys, desc: 'The name of the integration'
end
get "#{path}/:slug" do
integration = user_project.find_or_initialize_integration(params[:slug].underscore)
not_found!('Service') unless integration&.persisted?
not_found!('Integration') unless integration&.persisted?
present integration, with: Entities::ProjectIntegration
present integration, with: Entities::ProjectIntegration
end
end
end
TRIGGER_INTEGRATIONS.each do |integration_slug, settings|
helpers do
def slash_command_integration(project, integration_slug, params)
project.integrations.active.find do |integration|
integration.try(:token) == params[:token] && integration.to_param == integration_slug.underscore
TRIGGER_INTEGRATIONS.each do |integration_slug, settings|
helpers do
def slash_command_integration(project, integration_slug, params)
project.integrations.active.find do |integration|
integration.try(:token) == params[:token] && integration.to_param == integration_slug.underscore
end
end
end
end
params do
requires :id, type: String, desc: 'The ID of a project'
end
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
desc "Trigger a slash command for #{integration_slug}" do
detail 'Added in GitLab 8.13'
end
params do
settings.each do |setting|
requires setting[:name], type: setting[:type], desc: setting[:desc]
end
requires :id, type: String, desc: 'The ID of a project'
end
post ":id/services/#{integration_slug.underscore}/trigger" do
project = find_project(params[:id])
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
desc "Trigger a slash command for #{integration_slug}" do
detail 'Added in GitLab 8.13'
end
params do
settings.each do |setting|
requires setting[:name], type: setting[:type], desc: setting[:desc]
end
end
post "#{path}/#{integration_slug.underscore}/trigger" do
project = find_project(params[:id])
# This is not accurate, but done to prevent leakage of the project names
not_found!('Service') unless project
# This is not accurate, but done to prevent leakage of the project names
not_found!('Integration') unless project
integration = slash_command_integration(project, integration_slug, params)
result = integration.try(:trigger, params)
integration = slash_command_integration(project, integration_slug, params)
result = integration.try(:trigger, params)
if result
status result[:status] || 200
present result
else
not_found!('Service')
if result
status result[:status] || 200
present result
else
not_found!('Integration')
end
end
end
end
......@@ -170,4 +175,4 @@ module API
end
end
API::Services.prepend_mod_with('API::Services')
API::Integrations.prepend_mod_with('API::Integrations')
......@@ -30,7 +30,7 @@ module Gitlab
# Returns a class which inherits from the BaseService
# class that can be used to obtain a dashboard for
# the provided params.
# @return [Gitlab::Metrics::Dashboard::Services::BaseService]
# @return [Metrics::Dashboard::BaseService]
def call(params)
service = services.find do |service_class|
service_class.valid_params?(params)
......
{
"type": "array",
"items": { "$ref": "service.json" }
"items": { "$ref": "integration.json" }
}
# frozen_string_literal: true
require "spec_helper"
RSpec.describe API::Integrations do
let_it_be(:user) { create(:user) }
let_it_be(:user2) { create(:user) }
let_it_be(:project, reload: true) do
create(:project, creator_id: user.id, namespace: user.namespace)
end
%w[integrations services].each do |endpoint|
describe "GET /projects/:id/#{endpoint}" do
it 'returns authentication error when unauthenticated' do
get api("/projects/#{project.id}/#{endpoint}")
expect(response).to have_gitlab_http_status(:unauthorized)
end
it "returns error when authenticated but user is not a project owner" do
project.add_developer(user2)
get api("/projects/#{project.id}/#{endpoint}", user2)
expect(response).to have_gitlab_http_status(:forbidden)
end
context 'with integrations' do
let!(:active_integration) { create(:emails_on_push_integration, project: project, active: true) }
let!(:integration) { create(:custom_issue_tracker_integration, project: project, active: false) }
it "returns a list of all active integrations" do
get api("/projects/#{project.id}/#{endpoint}", user)
aggregate_failures 'expect successful response with all active integrations' do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_an Array
expect(json_response.count).to eq(1)
expect(json_response.first['slug']).to eq('emails-on-push')
expect(response).to match_response_schema('public_api/v4/integrations')
end
end
end
end
Integration.available_integration_names.each do |integration|
describe "PUT /projects/:id/#{endpoint}/#{integration.dasherize}" do
include_context integration
it "updates #{integration} settings" do
put api("/projects/#{project.id}/#{endpoint}/#{dashed_integration}", user), params: integration_attrs
expect(response).to have_gitlab_http_status(:ok)
current_integration = project.integrations.first
events = current_integration.event_names.empty? ? ["foo"].freeze : current_integration.event_names
query_strings = []
events.each do |event|
query_strings << "#{event}=#{!current_integration[event]}"
end
query_strings = query_strings.join('&')
put api("/projects/#{project.id}/#{endpoint}/#{dashed_integration}?#{query_strings}", user), params: integration_attrs
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['slug']).to eq(dashed_integration)
events.each do |event|
next if event == "foo"
expect(project.integrations.first[event]).not_to eq(current_integration[event]),
"expected #{!current_integration[event]} for event #{event} for #{endpoint} #{current_integration.title}, got #{current_integration[event]}"
end
end
it "returns if required fields missing" do
required_attributes = integration_attrs_list.select do |attr|
integration_klass.validators_on(attr).any? do |v|
v.instance_of?(ActiveRecord::Validations::PresenceValidator) &&
# exclude presence validators with conditional since those are not really required
![:if, :unless].any? { |cond| v.options.include?(cond) }
end
end
if required_attributes.empty?
expected_code = :ok
else
integration_attrs.delete(required_attributes.sample)
expected_code = :bad_request
end
put api("/projects/#{project.id}/#{endpoint}/#{dashed_integration}", user), params: integration_attrs
expect(response).to have_gitlab_http_status(expected_code)
end
end
describe "DELETE /projects/:id/#{endpoint}/#{integration.dasherize}" do
include_context integration
before do
initialize_integration(integration)
end
it "deletes #{integration}" do
delete api("/projects/#{project.id}/#{endpoint}/#{dashed_integration}", user)
expect(response).to have_gitlab_http_status(:no_content)
project.send(integration_method).reload
expect(project.send(integration_method).activated?).to be_falsey
end
end
describe "GET /projects/:id/#{endpoint}/#{integration.dasherize}" do
include_context integration
let!(:initialized_integration) { initialize_integration(integration, active: true) }
let_it_be(:project2) do
create(:project, creator_id: user.id, namespace: user.namespace)
end
def deactive_integration!
return initialized_integration.update!(active: false) unless initialized_integration.is_a?(::Integrations::Prometheus)
# Integrations::Prometheus sets `#active` itself within a `before_save`:
initialized_integration.manual_configuration = false
initialized_integration.save!
end
it 'returns authentication error when unauthenticated' do
get api("/projects/#{project.id}/#{endpoint}/#{dashed_integration}")
expect(response).to have_gitlab_http_status(:unauthorized)
end
it "returns all properties of active integration #{integration}" do
get api("/projects/#{project.id}/#{endpoint}/#{dashed_integration}", user)
expect(initialized_integration).to be_active
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['properties'].keys).to match_array(integration_instance.api_field_names)
end
it "returns all properties of inactive integration #{integration}" do
deactive_integration!
get api("/projects/#{project.id}/#{endpoint}/#{dashed_integration}", user)
expect(initialized_integration).not_to be_active
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['properties'].keys).to match_array(integration_instance.api_field_names)
end
it "returns not found if integration does not exist" do
get api("/projects/#{project2.id}/#{endpoint}/#{dashed_integration}", user)
expect(response).to have_gitlab_http_status(:not_found)
expect(json_response['message']).to eq('404 Integration Not Found')
end
it "returns not found if integration exists but is in `Project#disabled_integrations`" do
expect_next_found_instance_of(Project) do |project|
expect(project).to receive(:disabled_integrations).at_least(:once).and_return([integration])
end
get api("/projects/#{project.id}/#{endpoint}/#{dashed_integration}", user)
expect(response).to have_gitlab_http_status(:not_found)
expect(json_response['message']).to eq('404 Integration Not Found')
end
it "returns error when authenticated but not a project owner" do
project.add_developer(user2)
get api("/projects/#{project.id}/#{endpoint}/#{dashed_integration}", user2)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
end
describe "POST /projects/:id/#{endpoint}/:slug/trigger" do
describe 'Mattermost integration' do
let(:integration_name) { 'mattermost_slash_commands' }
context 'when no integration is available' do
it 'returns a not found message' do
post api("/projects/#{project.id}/#{endpoint}/idonotexist/trigger")
expect(response).to have_gitlab_http_status(:not_found)
expect(json_response["error"]).to eq("404 Not Found")
end
end
context 'when the integration exists' do
let(:params) { { token: 'token' } }
context 'when the integration is not active' do
before do
project.create_mattermost_slash_commands_integration(
active: false,
properties: params
)
end
it 'when the integration is inactive' do
post api("/projects/#{project.id}/#{endpoint}/#{integration_name}/trigger"), params: params
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'when the integration is active' do
before do
project.create_mattermost_slash_commands_integration(
active: true,
properties: params
)
end
it 'returns status 200' do
post api("/projects/#{project.id}/#{endpoint}/#{integration_name}/trigger"), params: params
expect(response).to have_gitlab_http_status(:ok)
end
end
context 'when the project can not be found' do
it 'returns a generic 404' do
post api("/projects/404/#{endpoint}/#{integration_name}/trigger"), params: params
expect(response).to have_gitlab_http_status(:not_found)
expect(json_response["message"]).to eq("404 Integration Not Found")
end
end
end
end
describe 'Slack Integration' do
let(:integration_name) { 'slack_slash_commands' }
before do
project.create_slack_slash_commands_integration(
active: true,
properties: { token: 'token' }
)
end
it 'returns status 200' do
post api("/projects/#{project.id}/#{endpoint}/#{integration_name}/trigger"), params: { token: 'token', text: 'help' }
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['response_type']).to eq("ephemeral")
end
end
end
describe 'Mattermost integration' do
let(:integration_name) { 'mattermost' }
let(:params) do
{ webhook: 'https://hook.example.com', username: 'username' }
end
before do
project.create_mattermost_integration(
active: true,
properties: params
)
end
it 'accepts a username for update' do
put api("/projects/#{project.id}/#{endpoint}/#{integration_name}", user), params: params.merge(username: 'new_username')
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['properties']['username']).to eq('new_username')
end
end
describe 'Microsoft Teams integration' do
let(:integration_name) { 'microsoft-teams' }
let(:params) do
{
webhook: 'https://hook.example.com',
branches_to_be_notified: 'default',
notify_only_broken_pipelines: false
}
end
before do
project.create_microsoft_teams_integration(
active: true,
properties: params
)
end
it 'accepts branches_to_be_notified for update' do
put api("/projects/#{project.id}/#{endpoint}/#{integration_name}", user),
params: params.merge(branches_to_be_notified: 'all')
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['properties']['branches_to_be_notified']).to eq('all')
end
it 'accepts notify_only_broken_pipelines for update' do
put api("/projects/#{project.id}/#{endpoint}/#{integration_name}", user),
params: params.merge(notify_only_broken_pipelines: true)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['properties']['notify_only_broken_pipelines']).to eq(true)
end
end
describe 'Hangouts Chat integration' do
let(:integration_name) { 'hangouts-chat' }
let(:params) do
{
webhook: 'https://hook.example.com',
branches_to_be_notified: 'default'
}
end
before do
project.create_hangouts_chat_integration(
active: true,
properties: params
)
end
it 'accepts branches_to_be_notified for update', :aggregate_failures do
put api("/projects/#{project.id}/#{endpoint}/#{integration_name}", user), params: params.merge(branches_to_be_notified: 'all')
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['properties']['branches_to_be_notified']).to eq('all')
end
it 'only requires the webhook param' do
put api("/projects/#{project.id}/#{endpoint}/#{integration_name}", user), params: { webhook: 'https://hook.example.com' }
expect(response).to have_gitlab_http_status(:ok)
end
end
describe 'Pipelines Email Integration' do
let(:integration_name) { 'pipelines-email' }
context 'notify_only_broken_pipelines property was saved as a string' do
before do
project.create_pipelines_email_integration(
active: false,
properties: {
"notify_only_broken_pipelines": "true",
"branches_to_be_notified": "default"
}
)
end
it 'returns boolean values for notify_only_broken_pipelines' do
get api("/projects/#{project.id}/#{endpoint}/#{integration_name}", user)
expect(json_response['properties']['notify_only_broken_pipelines']).to eq(true)
end
end
end
end
end
# frozen_string_literal: true
require "spec_helper"
RSpec.describe API::Services do
let_it_be(:user) { create(:user) }
let_it_be(:user2) { create(:user) }
let_it_be(:project, reload: true) do
create(:project, creator_id: user.id, namespace: user.namespace)
end
describe "GET /projects/:id/services" do
it 'returns authentication error when unauthenticated' do
get api("/projects/#{project.id}/services")
expect(response).to have_gitlab_http_status(:unauthorized)
end
it "returns error when authenticated but user is not a project owner" do
project.add_developer(user2)
get api("/projects/#{project.id}/services", user2)
expect(response).to have_gitlab_http_status(:forbidden)
end
context 'with integrations' do
let!(:active_integration) { create(:emails_on_push_integration, project: project, active: true) }
let!(:integration) { create(:custom_issue_tracker_integration, project: project, active: false) }
it "returns a list of all active integrations" do
get api("/projects/#{project.id}/services", user)
aggregate_failures 'expect successful response with all active integrations' do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_an Array
expect(json_response.count).to eq(1)
expect(json_response.first['slug']).to eq('emails-on-push')
expect(response).to match_response_schema('public_api/v4/services')
end
end
end
end
Integration.available_integration_names.each do |integration|
describe "PUT /projects/:id/services/#{integration.dasherize}" do
include_context integration
it "updates #{integration} settings" do
put api("/projects/#{project.id}/services/#{dashed_integration}", user), params: integration_attrs
expect(response).to have_gitlab_http_status(:ok)
current_integration = project.integrations.first
events = current_integration.event_names.empty? ? ["foo"].freeze : current_integration.event_names
query_strings = []
events.each do |event|
query_strings << "#{event}=#{!current_integration[event]}"
end
query_strings = query_strings.join('&')
put api("/projects/#{project.id}/services/#{dashed_integration}?#{query_strings}", user), params: integration_attrs
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['slug']).to eq(dashed_integration)
events.each do |event|
next if event == "foo"
expect(project.integrations.first[event]).not_to eq(current_integration[event]),
"expected #{!current_integration[event]} for event #{event} for service #{current_integration.title}, got #{current_integration[event]}"
end
end
it "returns if required fields missing" do
required_attributes = integration_attrs_list.select do |attr|
integration_klass.validators_on(attr).any? do |v|
v.instance_of?(ActiveRecord::Validations::PresenceValidator) &&
# exclude presence validators with conditional since those are not really required
![:if, :unless].any? { |cond| v.options.include?(cond) }
end
end
if required_attributes.empty?
expected_code = :ok
else
integration_attrs.delete(required_attributes.sample)
expected_code = :bad_request
end
put api("/projects/#{project.id}/services/#{dashed_integration}", user), params: integration_attrs
expect(response).to have_gitlab_http_status(expected_code)
end
end
describe "DELETE /projects/:id/services/#{integration.dasherize}" do
include_context integration
before do
initialize_integration(integration)
end
it "deletes #{integration}" do
delete api("/projects/#{project.id}/services/#{dashed_integration}", user)
expect(response).to have_gitlab_http_status(:no_content)
project.send(integration_method).reload
expect(project.send(integration_method).activated?).to be_falsey
end
end
describe "GET /projects/:id/services/#{integration.dasherize}" do
include_context integration
let!(:initialized_integration) { initialize_integration(integration, active: true) }
let_it_be(:project2) do
create(:project, creator_id: user.id, namespace: user.namespace)
end
def deactive_integration!
return initialized_integration.update!(active: false) unless initialized_integration.is_a?(::Integrations::Prometheus)
# Integrations::Prometheus sets `#active` itself within a `before_save`:
initialized_integration.manual_configuration = false
initialized_integration.save!
end
it 'returns authentication error when unauthenticated' do
get api("/projects/#{project.id}/services/#{dashed_integration}")
expect(response).to have_gitlab_http_status(:unauthorized)
end
it "returns all properties of active service #{integration}" do
get api("/projects/#{project.id}/services/#{dashed_integration}", user)
expect(initialized_integration).to be_active
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['properties'].keys).to match_array(integration_instance.api_field_names)
end
it "returns all properties of inactive integration #{integration}" do
deactive_integration!
get api("/projects/#{project.id}/services/#{dashed_integration}", user)
expect(initialized_integration).not_to be_active
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['properties'].keys).to match_array(integration_instance.api_field_names)
end
it "returns not found if integration does not exist" do
get api("/projects/#{project2.id}/services/#{dashed_integration}", user)
expect(response).to have_gitlab_http_status(:not_found)
expect(json_response['message']).to eq('404 Service Not Found')
end
it "returns not found if service exists but is in `Project#disabled_integrations`" do
expect_next_found_instance_of(Project) do |project|
expect(project).to receive(:disabled_integrations).at_least(:once).and_return([integration])
end
get api("/projects/#{project.id}/services/#{dashed_integration}", user)
expect(response).to have_gitlab_http_status(:not_found)
expect(json_response['message']).to eq('404 Service Not Found')
end
it "returns error when authenticated but not a project owner" do
project.add_developer(user2)
get api("/projects/#{project.id}/services/#{dashed_integration}", user2)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
end
describe 'POST /projects/:id/services/:slug/trigger' do
describe 'Mattermost integration' do
let(:integration_name) { 'mattermost_slash_commands' }
context 'when no integration is available' do
it 'returns a not found message' do
post api("/projects/#{project.id}/services/idonotexist/trigger")
expect(response).to have_gitlab_http_status(:not_found)
expect(json_response["error"]).to eq("404 Not Found")
end
end
context 'when the integration exists' do
let(:params) { { token: 'token' } }
context 'when the integration is not active' do
before do
project.create_mattermost_slash_commands_integration(
active: false,
properties: params
)
end
it 'when the integration is inactive' do
post api("/projects/#{project.id}/services/#{integration_name}/trigger"), params: params
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'when the integration is active' do
before do
project.create_mattermost_slash_commands_integration(
active: true,
properties: params
)
end
it 'returns status 200' do
post api("/projects/#{project.id}/services/#{integration_name}/trigger"), params: params
expect(response).to have_gitlab_http_status(:ok)
end
end
context 'when the project can not be found' do
it 'returns a generic 404' do
post api("/projects/404/services/#{integration_name}/trigger"), params: params
expect(response).to have_gitlab_http_status(:not_found)
expect(json_response["message"]).to eq("404 Service Not Found")
end
end
end
end
describe 'Slack Integration' do
let(:integration_name) { 'slack_slash_commands' }
before do
project.create_slack_slash_commands_integration(
active: true,
properties: { token: 'token' }
)
end
it 'returns status 200' do
post api("/projects/#{project.id}/services/#{integration_name}/trigger"), params: { token: 'token', text: 'help' }
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['response_type']).to eq("ephemeral")
end
end
end
describe 'Mattermost integration' do
let(:integration_name) { 'mattermost' }
let(:params) do
{ webhook: 'https://hook.example.com', username: 'username' }
end
before do
project.create_mattermost_integration(
active: true,
properties: params
)
end
it 'accepts a username for update' do
put api("/projects/#{project.id}/services/#{integration_name}", user), params: params.merge(username: 'new_username')
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['properties']['username']).to eq('new_username')
end
end
describe 'Microsoft Teams integration' do
let(:integration_name) { 'microsoft-teams' }
let(:params) do
{
webhook: 'https://hook.example.com',
branches_to_be_notified: 'default',
notify_only_broken_pipelines: false
}
end
before do
project.create_microsoft_teams_integration(
active: true,
properties: params
)
end
it 'accepts branches_to_be_notified for update' do
put api("/projects/#{project.id}/services/#{integration_name}", user),
params: params.merge(branches_to_be_notified: 'all')
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['properties']['branches_to_be_notified']).to eq('all')
end
it 'accepts notify_only_broken_pipelines for update' do
put api("/projects/#{project.id}/services/#{integration_name}", user),
params: params.merge(notify_only_broken_pipelines: true)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['properties']['notify_only_broken_pipelines']).to eq(true)
end
end
describe 'Hangouts Chat integration' do
let(:integration_name) { 'hangouts-chat' }
let(:params) do
{
webhook: 'https://hook.example.com',
branches_to_be_notified: 'default'
}
end
before do
project.create_hangouts_chat_integration(
active: true,
properties: params
)
end
it 'accepts branches_to_be_notified for update', :aggregate_failures do
put api("/projects/#{project.id}/services/#{integration_name}", user), params: params.merge(branches_to_be_notified: 'all')
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['properties']['branches_to_be_notified']).to eq('all')
end
it 'only requires the webhook param' do
put api("/projects/#{project.id}/services/#{integration_name}", user), params: { webhook: 'https://hook.example.com' }
expect(response).to have_gitlab_http_status(:ok)
end
end
describe 'Pipelines Email Integration' do
let(:integration_name) { 'pipelines-email' }
context 'notify_only_broken_pipelines property was saved as a string' do
before do
project.create_pipelines_email_integration(
active: false,
properties: {
"notify_only_broken_pipelines": "true",
"branches_to_be_notified": "default"
}
)
end
it 'returns boolean values for notify_only_broken_pipelines' do
get api("/projects/#{project.id}/services/#{integration_name}", user)
expect(json_response['properties']['notify_only_broken_pipelines']).to eq(true)
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment