338.md 6.3 KB
Newer Older
Lab机器人's avatar
readme  
Lab机器人 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
# Project milestones API

> 原文:[https://docs.gitlab.com/ee/api/milestones.html](https://docs.gitlab.com/ee/api/milestones.html)

*   [List project milestones](#list-project-milestones)
*   [Get single milestone](#get-single-milestone)
*   [Create new milestone](#create-new-milestone)
*   [Edit milestone](#edit-milestone)
*   [Delete project milestone](#delete-project-milestone)
*   [Get all issues assigned to a single milestone](#get-all-issues-assigned-to-a-single-milestone)
*   [Get all merge requests assigned to a single milestone](#get-all-merge-requests-assigned-to-a-single-milestone)
*   [Promote project milestone to a group milestone](#promote-project-milestone-to-a-group-milestone)
*   [Get all burndown chart events for a single milestone](#get-all-burndown-chart-events-for-a-single-milestone-starter)

# Project milestones API[](#project-milestones-api "Permalink")

This page describes the project milestones API. There’s a separate [group milestones API](./group_milestones.html) page.

## List project milestones[](#list-project-milestones "Permalink")

返回项目里程碑的列表.

```
GET /projects/:id/milestones
GET /projects/:id/milestones?iids[]=42
GET /projects/:id/milestones?iids[]=42&iids[]=43
GET /projects/:id/milestones?state=active
GET /projects/:id/milestones?state=closed
GET /projects/:id/milestones?title=1.0
GET /projects/:id/milestones?search=version 
```

Parameters:

| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer/string | yes | 经过身份验证的用户拥有[的项目](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding) |
| `iids[]` | 整数数组 | optional | 仅返回具有给定`iid`的里程碑 |
| `state` | string | optional | 仅返回`active``closed`里程碑 |
| `title` | string | optional | 仅返回具有给定`title`的里程碑 |
| `search` | string | optional | 仅返回标题或描述与提供的字符串匹配的里程碑 |

```
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/milestones" 
```

示例响应:

```
[  {  "id":  12,  "iid":  3,  "project_id":  16,  "title":  "10.0",  "description":  "Version",  "due_date":  "2013-11-29",  "start_date":  "2013-11-10",  "state":  "active",  "updated_at":  "2013-10-02T09:24:18Z",  "created_at":  "2013-10-02T09:24:18Z"  }  ] 
```

## Get single milestone[](#get-single-milestone "Permalink")

获得单个项目里程碑.

```
GET /projects/:id/milestones/:milestone_id 
```

Parameters:

*   `id` (必填)-经过身份验证的用户拥有[的项目](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding)
*   `milestone_id` (必填)-项目里程碑的 ID

## Create new milestone[](#create-new-milestone "Permalink")

创建一个新的项目里程碑.

```
POST /projects/:id/milestones 
```

Parameters:

*   `id` (必填)-经过身份验证的用户拥有[的项目](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding)
*   `title` (必填)-里程碑的标题
*   `description` (可选)-里程碑的说明
*   `due_date` (可选)-里程碑的截止日期
*   `start_date` (可选)-里程碑的开始日期

## Edit milestone[](#edit-milestone "Permalink")

更新现有项目的里程碑.

```
PUT /projects/:id/milestones/:milestone_id 
```

Parameters:

*   `id` (必填)-经过身份验证的用户拥有[的项目](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding)
*   `milestone_id` (必填)-项目里程碑的 ID
*   `title` (可选)-里程碑的标题
*   `description` (可选)-里程碑的说明
*   `due_date` (可选)-里程碑的截止日期
*   `start_date` (可选)-里程碑的开始日期
*   `state_event` (可选)-里程碑的状态事件(关闭或激活)

## Delete project milestone[](#delete-project-milestone "Permalink")

仅适用于具有开发人员访问项目权限的用户.

```
DELETE /projects/:id/milestones/:milestone_id 
```

Parameters:

*   `id` (必填)-经过身份验证的用户拥有[的项目](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding)
*   `milestone_id` (必填)-项目里程碑的 ID

## Get all issues assigned to a single milestone[](#get-all-issues-assigned-to-a-single-milestone "Permalink")

获取分配给单个项目里程碑的所有问题.

```
GET /projects/:id/milestones/:milestone_id/issues 
```

Parameters:

*   `id` (必填)-经过身份验证的用户拥有[的项目](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding)
*   `milestone_id` (必填)-项目里程碑的 ID

## Get all merge requests assigned to a single milestone[](#get-all-merge-requests-assigned-to-a-single-milestone "Permalink")

获取分配给单个项目里程碑的所有合并请求.

```
GET /projects/:id/milestones/:milestone_id/merge_requests 
```

Parameters:

*   `id` (必填)-经过身份验证的用户拥有[的项目](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding)
*   `milestone_id` (必填)-项目里程碑的 ID

## Promote project milestone to a group milestone[](#promote-project-milestone-to-a-group-milestone "Permalink")

在 GitLab 11.9 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/53861)

仅针对具有开发者访问权限的用户.

```
POST /projects/:id/milestones/:milestone_id/promote 
```

Parameters:

*   `id` (必填)-经过身份验证的用户拥有[的项目](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding)
*   `milestone_id` (必填)-项目里程碑的 ID

## Get all burndown chart events for a single milestone[](#get-all-burndown-chart-events-for-a-single-milestone-starter "Permalink")

在 GitLab 12.1 中[引入](https://gitlab.com/gitlab-org/gitlab/-/issues/4737)

获取单个里程碑的所有燃尽图事件.

```
GET /projects/:id/milestones/:milestone_id/burndown_events 
```

Parameters:

*   `id` (必填)-经过身份验证的用户拥有[的项目](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding)
*   `milestone_id` (必填)-项目里程碑的 ID