debian-mirror-gitlab/doc/api/notification_settings.md

186 lines
5.5 KiB
Markdown
Raw Normal View History

2017-09-10 17:25:29 +05:30
# Notification settings API
2016-09-29 09:46:39 +05:30
>**Note:** This feature was [introduced][ce-5632] in GitLab 8.12.
**Valid notification levels**
2017-08-17 22:00:37 +05:30
The notification levels are defined in the `NotificationSetting.level` model enumeration. Currently, these levels are recognized:
2016-09-29 09:46:39 +05:30
```
disabled
participating
watch
global
mention
custom
```
2018-11-20 20:47:30 +05:30
If the `custom` level is used, specific email events can be controlled. Available events are returned by `NotificationSetting.email_events`. Currently, these events are recognized:
2016-09-29 09:46:39 +05:30
```
new_note
new_issue
reopen_issue
close_issue
reassign_issue
2018-10-15 14:42:47 +05:30
issue_due
2016-09-29 09:46:39 +05:30
new_merge_request
2018-05-09 12:01:36 +05:30
push_to_merge_request
2016-09-29 09:46:39 +05:30
reopen_merge_request
close_merge_request
reassign_merge_request
merge_merge_request
2017-08-17 22:00:37 +05:30
failed_pipeline
success_pipeline
2016-09-29 09:46:39 +05:30
```
## Global notification settings
Get current notification settings and email address.
```
GET /notification_settings
```
```bash
2019-02-13 22:33:31 +05:30
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/notification_settings
2016-09-29 09:46:39 +05:30
```
Example response:
```json
{
"level": "participating",
"notification_email": "admin@example.com"
}
```
## Update global notification settings
Update current notification settings and email address.
```
PUT /notification_settings
```
```bash
2019-02-13 22:33:31 +05:30
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/notification_settings?level=watch
2016-09-29 09:46:39 +05:30
```
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `level` | string | no | The global notification level |
| `notification_email` | string | no | The email address to send notifications |
| `new_note` | boolean | no | Enable/disable this notification |
| `new_issue` | boolean | no | Enable/disable this notification |
| `reopen_issue` | boolean | no | Enable/disable this notification |
| `close_issue` | boolean | no | Enable/disable this notification |
| `reassign_issue` | boolean | no | Enable/disable this notification |
2018-10-15 14:42:47 +05:30
| `issue_due` | boolean | no | Enable/disable this notification |
2016-09-29 09:46:39 +05:30
| `new_merge_request` | boolean | no | Enable/disable this notification |
2018-05-09 12:01:36 +05:30
| `push_to_merge_request` | boolean | no | Enable/disable this notification |
2016-09-29 09:46:39 +05:30
| `reopen_merge_request` | boolean | no | Enable/disable this notification |
| `close_merge_request` | boolean | no | Enable/disable this notification |
| `reassign_merge_request` | boolean | no | Enable/disable this notification |
| `merge_merge_request` | boolean | no | Enable/disable this notification |
2017-08-17 22:00:37 +05:30
| `failed_pipeline` | boolean | no | Enable/disable this notification |
| `success_pipeline` | boolean | no | Enable/disable this notification |
2016-09-29 09:46:39 +05:30
Example response:
```json
{
"level": "watch",
"notification_email": "admin@example.com"
}
```
## Group / project level notification settings
Get current group or project notification settings.
```
GET /groups/:id/notification_settings
GET /projects/:id/notification_settings
```
```bash
2019-02-13 22:33:31 +05:30
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/5/notification_settings
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/8/notification_settings
2016-09-29 09:46:39 +05:30
```
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id` | integer/string | yes | The group/project ID or path |
Example response:
```json
{
"level": "global"
}
```
## Update group/project level notification settings
Update current group/project notification settings.
```
PUT /groups/:id/notification_settings
PUT /projects/:id/notification_settings
```
```bash
2019-02-13 22:33:31 +05:30
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/5/notification_settings?level=watch
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/8/notification_settings?level=custom&new_note=true
2016-09-29 09:46:39 +05:30
```
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id` | integer/string | yes | The group/project ID or path |
| `level` | string | no | The global notification level |
| `new_note` | boolean | no | Enable/disable this notification |
| `new_issue` | boolean | no | Enable/disable this notification |
| `reopen_issue` | boolean | no | Enable/disable this notification |
| `close_issue` | boolean | no | Enable/disable this notification |
| `reassign_issue` | boolean | no | Enable/disable this notification |
2018-10-15 14:42:47 +05:30
| `issue_due` | boolean | no | Enable/disable this notification |
2016-09-29 09:46:39 +05:30
| `new_merge_request` | boolean | no | Enable/disable this notification |
2018-05-09 12:01:36 +05:30
| `push_to_merge_request` | boolean | no | Enable/disable this notification |
2016-09-29 09:46:39 +05:30
| `reopen_merge_request` | boolean | no | Enable/disable this notification |
| `close_merge_request` | boolean | no | Enable/disable this notification |
| `reassign_merge_request` | boolean | no | Enable/disable this notification |
| `merge_merge_request` | boolean | no | Enable/disable this notification |
2017-08-17 22:00:37 +05:30
| `failed_pipeline` | boolean | no | Enable/disable this notification |
| `success_pipeline` | boolean | no | Enable/disable this notification |
2016-09-29 09:46:39 +05:30
Example responses:
```json
{
"level": "watch"
}
{
"level": "custom",
"events": {
"new_note": true,
"new_issue": false,
"reopen_issue": false,
"close_issue": false,
"reassign_issue": false,
2018-10-15 14:42:47 +05:30
"issue_due": false,
2016-09-29 09:46:39 +05:30
"new_merge_request": false,
2018-05-09 12:01:36 +05:30
"push_to_merge_request": false,
2016-09-29 09:46:39 +05:30
"reopen_merge_request": false,
"close_merge_request": false,
"reassign_merge_request": false,
2017-08-17 22:00:37 +05:30
"merge_merge_request": false,
"failed_pipeline": false,
"success_pipeline": false
2016-09-29 09:46:39 +05:30
}
}
```
[ce-5632]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5632