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

299 lines
9.9 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
---
2017-09-10 17:25:29 +05:30
# Todos 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
## Get a list of todos
Returns a list of todos. When no filter is applied, it returns all pending todos
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 |
| --------- | ---- | -------- | ----------- |
2018-10-15 14:42:47 +05:30
| `action` | string | no | The action to be filtered. Can be `assigned`, `mentioned`, `build_failed`, `marked`, `approval_required`, `unmergeable` or `directly_addressed`. |
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 |
2016-08-24 12:49:21 +05:30
| `state` | string | no | The state of the todo. Can be either `pending` or `done` |
| `type` | string | no | The type of a todo. Can be either `Issue` or `MergeRequest` |
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
}
]
```
## Mark a todo as done
Marks a single pending todo given by its ID for the current user as done. The
todo marked as done is returned in the response.
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 |
| --------- | ---- | -------- | ----------- |
| `id` | integer | yes | The ID of a todo |
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
}
```
## Mark all todos as done
2017-08-17 22:00:37 +05:30
Marks all pending todos 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
```