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

299 lines
10 KiB
Markdown
Raw Normal View History

2020-06-23 00:09:42 +05:30
---
stage: Plan
group: Project Management
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/#designated-technical-writers
---
2020-11-24 15:15:51 +05:30
# To-dos API
2016-08-24 12:49:21 +05:30
2020-04-22 19:07:51 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/3188) in GitLab 8.10.
2016-08-24 12:49:21 +05:30
2020-11-24 15:15:51 +05:30
## Get a list of to-dos
2016-08-24 12:49:21 +05:30
2020-11-24 15:15:51 +05:30
Returns a list of to-dos. When no filter is applied, it returns all pending to-dos
2016-08-24 12:49:21 +05:30
for the current user. Different filters allow the user to precise the request.
2020-04-08 14:13:33 +05:30
```plaintext
2016-08-24 12:49:21 +05:30
GET /todos
```
Parameters:
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
2020-11-24 15:15:51 +05:30
| `action` | string | no | The action to be filtered. Can be `assigned`, `mentioned`, `build_failed`, `marked`, `approval_required`, `unmergeable`, `directly_addressed` or `merge_train_removed`. |
2016-08-24 12:49:21 +05:30
| `author_id` | integer | no | The ID of an author |
| `project_id` | integer | no | The ID of a project |
2018-11-18 11:00:15 +05:30
| `group_id` | integer | no | The ID of a group |
2020-11-24 15:15:51 +05:30
| `state` | string | no | The state of the to-do. Can be either `pending` or `done` |
| `type` | string | no | The type of a to-do. Can be either `Issue`, `MergeRequest`, `DesignManagement::Design` or `AlertManagement::Alert` |
2016-08-24 12:49:21 +05:30
2020-03-13 15:44:24 +05:30
```shell
2020-06-23 00:09:42 +05:30
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/todos"
2016-08-24 12:49:21 +05:30
```
Example Response:
```json
[
{
"id": 102,
"project": {
"id": 2,
"name": "Gitlab Ce",
"name_with_namespace": "Gitlab Org / Gitlab Ce",
2019-12-21 20:55:43 +05:30
"path": "gitlab-foss",
"path_with_namespace": "gitlab-org/gitlab-foss"
2016-08-24 12:49:21 +05:30
},
"author": {
"name": "Administrator",
"username": "root",
"id": 1,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
2016-11-03 12:29:30 +05:30
"web_url": "https://gitlab.example.com/root"
2016-08-24 12:49:21 +05:30
},
"action_name": "marked",
"target_type": "MergeRequest",
"target": {
"id": 34,
"iid": 7,
"project_id": 2,
"title": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.",
"description": "Et ea et omnis illum cupiditate. Dolor aspernatur tenetur ducimus facilis est nihil. Quo esse cupiditate molestiae illo corrupti qui quidem dolor.",
"state": "opened",
"created_at": "2016-06-17T07:49:24.419Z",
"updated_at": "2016-06-17T07:52:43.484Z",
"target_branch": "tutorials_git_tricks",
"source_branch": "DNSBL_docs",
"upvotes": 0,
"downvotes": 0,
"author": {
"name": "Maxie Medhurst",
"username": "craig_rutherford",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon",
2016-11-03 12:29:30 +05:30
"web_url": "https://gitlab.example.com/craig_rutherford"
2016-08-24 12:49:21 +05:30
},
"assignee": {
"name": "Administrator",
"username": "root",
"id": 1,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
2016-11-03 12:29:30 +05:30
"web_url": "https://gitlab.example.com/root"
2016-08-24 12:49:21 +05:30
},
"source_project_id": 2,
"target_project_id": 2,
"labels": [],
"work_in_progress": false,
"milestone": {
"id": 32,
"iid": 2,
"project_id": 2,
"title": "v1.0",
"description": "Assumenda placeat ea voluptatem voluptate qui.",
"state": "active",
"created_at": "2016-06-17T07:47:34.163Z",
"updated_at": "2016-06-17T07:47:34.163Z",
"due_date": null
},
2017-08-17 22:00:37 +05:30
"merge_when_pipeline_succeeds": false,
2016-08-24 12:49:21 +05:30
"merge_status": "cannot_be_merged",
"subscribed": true,
"user_notes_count": 7
},
2020-03-13 15:44:24 +05:30
"target_url": "https://gitlab.example.com/gitlab-org/gitlab-foss/-/merge_requests/7",
2016-08-24 12:49:21 +05:30
"body": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.",
"state": "pending",
2020-05-24 23:13:21 +05:30
"created_at": "2016-06-17T07:52:35.225Z",
"updated_at": "2016-06-17T07:52:35.225Z"
2016-08-24 12:49:21 +05:30
},
{
"id": 98,
"project": {
"id": 2,
"name": "Gitlab Ce",
"name_with_namespace": "Gitlab Org / Gitlab Ce",
2019-12-21 20:55:43 +05:30
"path": "gitlab-foss",
"path_with_namespace": "gitlab-org/gitlab-foss"
2016-08-24 12:49:21 +05:30
},
"author": {
"name": "Maxie Medhurst",
"username": "craig_rutherford",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon",
2016-11-03 12:29:30 +05:30
"web_url": "https://gitlab.example.com/craig_rutherford"
2016-08-24 12:49:21 +05:30
},
"action_name": "assigned",
"target_type": "MergeRequest",
"target": {
"id": 34,
"iid": 7,
"project_id": 2,
"title": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.",
"description": "Et ea et omnis illum cupiditate. Dolor aspernatur tenetur ducimus facilis est nihil. Quo esse cupiditate molestiae illo corrupti qui quidem dolor.",
"state": "opened",
"created_at": "2016-06-17T07:49:24.419Z",
"updated_at": "2016-06-17T07:52:43.484Z",
"target_branch": "tutorials_git_tricks",
"source_branch": "DNSBL_docs",
"upvotes": 0,
"downvotes": 0,
"author": {
"name": "Maxie Medhurst",
"username": "craig_rutherford",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon",
2016-11-03 12:29:30 +05:30
"web_url": "https://gitlab.example.com/craig_rutherford"
2016-08-24 12:49:21 +05:30
},
"assignee": {
"name": "Administrator",
"username": "root",
"id": 1,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
2016-11-03 12:29:30 +05:30
"web_url": "https://gitlab.example.com/root"
2016-08-24 12:49:21 +05:30
},
"source_project_id": 2,
"target_project_id": 2,
"labels": [],
"work_in_progress": false,
"milestone": {
"id": 32,
"iid": 2,
"project_id": 2,
"title": "v1.0",
"description": "Assumenda placeat ea voluptatem voluptate qui.",
"state": "active",
"created_at": "2016-06-17T07:47:34.163Z",
"updated_at": "2016-06-17T07:47:34.163Z",
"due_date": null
},
2017-08-17 22:00:37 +05:30
"merge_when_pipeline_succeeds": false,
2016-08-24 12:49:21 +05:30
"merge_status": "cannot_be_merged",
"subscribed": true,
"user_notes_count": 7
},
2020-03-13 15:44:24 +05:30
"target_url": "https://gitlab.example.com/gitlab-org/gitlab-foss/-/merge_requests/7",
2016-08-24 12:49:21 +05:30
"body": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.",
"state": "pending",
2020-05-24 23:13:21 +05:30
"created_at": "2016-06-17T07:49:24.624Z",
"updated_at": "2016-06-17T07:49:24.624Z"
2016-08-24 12:49:21 +05:30
}
]
```
2020-11-24 15:15:51 +05:30
## Mark a to-do as done
2016-08-24 12:49:21 +05:30
2020-11-24 15:15:51 +05:30
Marks a single pending to-do given by its ID for the current user as done. The
to-do marked as done is returned in the response.
2016-08-24 12:49:21 +05:30
2020-04-08 14:13:33 +05:30
```plaintext
2017-08-17 22:00:37 +05:30
POST /todos/:id/mark_as_done
2016-08-24 12:49:21 +05:30
```
Parameters:
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
2020-11-24 15:15:51 +05:30
| `id` | integer | yes | The ID of a to-do |
2016-08-24 12:49:21 +05:30
2020-03-13 15:44:24 +05:30
```shell
2020-06-23 00:09:42 +05:30
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/todos/130/mark_as_done"
2016-08-24 12:49:21 +05:30
```
Example Response:
```json
{
"id": 102,
"project": {
"id": 2,
"name": "Gitlab Ce",
"name_with_namespace": "Gitlab Org / Gitlab Ce",
2019-12-21 20:55:43 +05:30
"path": "gitlab-foss",
"path_with_namespace": "gitlab-org/gitlab-foss"
2016-08-24 12:49:21 +05:30
},
"author": {
"name": "Administrator",
"username": "root",
"id": 1,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
2016-11-03 12:29:30 +05:30
"web_url": "https://gitlab.example.com/root"
2016-08-24 12:49:21 +05:30
},
"action_name": "marked",
"target_type": "MergeRequest",
"target": {
"id": 34,
"iid": 7,
"project_id": 2,
"title": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.",
"description": "Et ea et omnis illum cupiditate. Dolor aspernatur tenetur ducimus facilis est nihil. Quo esse cupiditate molestiae illo corrupti qui quidem dolor.",
"state": "opened",
"created_at": "2016-06-17T07:49:24.419Z",
"updated_at": "2016-06-17T07:52:43.484Z",
"target_branch": "tutorials_git_tricks",
"source_branch": "DNSBL_docs",
"upvotes": 0,
"downvotes": 0,
"author": {
"name": "Maxie Medhurst",
"username": "craig_rutherford",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon",
2016-11-03 12:29:30 +05:30
"web_url": "https://gitlab.example.com/craig_rutherford"
2016-08-24 12:49:21 +05:30
},
"assignee": {
"name": "Administrator",
"username": "root",
"id": 1,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
2016-11-03 12:29:30 +05:30
"web_url": "https://gitlab.example.com/root"
2016-08-24 12:49:21 +05:30
},
"source_project_id": 2,
"target_project_id": 2,
"labels": [],
"work_in_progress": false,
"milestone": {
"id": 32,
"iid": 2,
"project_id": 2,
"title": "v1.0",
"description": "Assumenda placeat ea voluptatem voluptate qui.",
"state": "active",
"created_at": "2016-06-17T07:47:34.163Z",
"updated_at": "2016-06-17T07:47:34.163Z",
"due_date": null
},
2017-08-17 22:00:37 +05:30
"merge_when_pipeline_succeeds": false,
2016-08-24 12:49:21 +05:30
"merge_status": "cannot_be_merged",
"subscribed": true,
"user_notes_count": 7
},
2020-03-13 15:44:24 +05:30
"target_url": "https://gitlab.example.com/gitlab-org/gitlab-foss/-/merge_requests/7",
2016-08-24 12:49:21 +05:30
"body": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.",
"state": "done",
2020-05-24 23:13:21 +05:30
"created_at": "2016-06-17T07:52:35.225Z",
"updated_at": "2016-06-17T07:52:35.225Z"
2016-08-24 12:49:21 +05:30
}
```
2020-11-24 15:15:51 +05:30
## Mark all to-dos as done
2016-08-24 12:49:21 +05:30
2020-11-24 15:15:51 +05:30
Marks all pending to-dos for the current user as done. It returns the HTTP status code `204` with an empty response.
2016-08-24 12:49:21 +05:30
2020-04-08 14:13:33 +05:30
```plaintext
2017-08-17 22:00:37 +05:30
POST /todos/mark_as_done
2016-08-24 12:49:21 +05:30
```
2020-03-13 15:44:24 +05:30
```shell
2020-06-23 00:09:42 +05:30
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/todos/mark_as_done"
2016-08-24 12:49:21 +05:30
```