332.md 9.5 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
# Epic Links API

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

*   [List epics related to a given epic](#list-epics-related-to-a-given-epic)
*   [Assign a child epic](#assign-a-child-epic)
*   [Create and assign a child epic](#create-and-assign-a-child-epic)
*   [Re-order a child epic](#re-order-a-child-epic)
*   [Unassign a child epic](#unassign-a-child-epic)

# Epic Links API[](#epic-links-api-ultimate "Permalink")

**注意:**该端点是在 GitLab 11.8 中[引入的](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/9188) .

管理亲子[史诗般的关系](../user/group/epics/index.html#multi-level-child-epics-ultimate) .

每个对`epic_links` API 调用`epic_links`必须经过身份验证.

如果用户不是组的成员,并且该组是私有的,则对该组的`GET`请求将导致`404`状态代码.

多级史诗仅在 GitLab [Ultimate / Gold](https://about.gitlab.com/pricing/)中可用. 如果"多级史诗"功能不可用,将返回`403`状态代码.

## List epics related to a given epic[](#list-epics-related-to-a-given-epic "Permalink")

获取史诗的所有子史诗.

```
GET /groups/:id/epics/:epic_iid/epics 
```

| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer/string | yes | 认证用户拥有[的组](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding) |
| `epic_iid` | integer | yes | 史诗的内部 ID. |

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

响应示例:

```
[  {  "id":  29,  "iid":  6,  "group_id":  1,  "parent_id":  5,  "title":  "Accusamus iste et ullam ratione voluptatem omnis debitis dolor est.",  "description":  "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",  "author":  {  "id":  10,  "name":  "Lu Mayer",  "username":  "kam",  "state":  "active",  "avatar_url":  "http://www.gravatar.com/avatar/018729e129a6f31c80a6327a30196823?s=80&d=identicon",  "web_url":  "http://localhost:3001/kam"  },  "start_date":  null,  "start_date_is_fixed":  false,  "start_date_fixed":  null,  "start_date_from_milestones":  null,  //deprecated  in  favor  of  start_date_from_inherited_source  "start_date_from_inherited_source":  null,  "end_date":  "2018-07-31",  //deprecated  in  favor  of  due_date  "due_date":  "2018-07-31",  "due_date_is_fixed":  false,  "due_date_fixed":  null,  "due_date_from_milestones":  "2018-07-31",  //deprecated  in  favor  of  start_date_from_inherited_source  "due_date_from_inherited_source":  "2018-07-31",  "created_at":  "2018-07-17T13:36:22.770Z",  "updated_at":  "2018-07-18T12:22:05.239Z",  "labels":  []  }  ] 
```

## Assign a child epic[](#assign-a-child-epic "Permalink")

在两个史诗之间创建关联,将一个史诗指定为父史诗,将另一个史诗指定为子史诗. 父史诗可以有多个子史诗. 如果新的子史诗已经属于另一个史诗,则该子史诗不会从先前的父史诗中分配.

```
POST /groups/:id/epics/:epic_iid/epics 
```

| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.html#namespaced-path-encoding) owned by the authenticated user |
| `epic_iid` | integer | yes | 史诗的内部 ID. |
| `child_epic_id` | integer | yes | 子史诗的全局 ID. 内部 ID 无法使用,因为它们可能与其他组的史诗冲突. |

```
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/epics/5/epics/6" 
```

响应示例:

```
{  "id":  6,  "iid":  38,  "group_id":  1,  "parent_id":  5  "title":  "Accusamus iste et ullam ratione voluptatem omnis debitis dolor est.",  "description":  "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",  "author":  {  "id":  10,  "name":  "Lu Mayer",  "username":  "kam",  "state":  "active",  "avatar_url":  "http://www.gravatar.com/avatar/018729e129a6f31c80a6327a30196823?s=80&d=identicon",  "web_url":  "http://localhost:3001/kam"  },  "start_date":  null,  "start_date_is_fixed":  false,  "start_date_fixed":  null,  "start_date_from_milestones":  null,  //deprecated  in  favor  of  start_date_from_inherited_source  "start_date_from_inherited_source":  null,  "end_date":  "2018-07-31",  //deprecated  in  favor  of  due_date  "due_date":  "2018-07-31",  "due_date_is_fixed":  false,  "due_date_fixed":  null,  "due_date_from_milestones":  "2018-07-31",  //deprecated  in  favor  of  start_date_from_inherited_source  "due_date_from_inherited_source":  "2018-07-31",  "created_at":  "2018-07-17T13:36:22.770Z",  "updated_at":  "2018-07-18T12:22:05.239Z",  "labels":  []  } 
```

## Create and assign a child epic[](#create-and-assign-a-child-epic "Permalink")

创建一个新的史诗并将其与提供的父史诗相关联. 响应是 LinkedEpic 对象.

```
POST /groups/:id/epics/:epic_iid/epics 
```

| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer/string | yes | 认证用户拥有[的组](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding) |
| `epic_iid` | integer | yes | (未来父级)史诗的内部 ID. |
| `title` | string | yes | 新创建的史诗的标题. |

```
curl --request POST --header  "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/epics/5/epics?title=Newpic" 
```

响应示例:

```
{  "id":  24,  "iid":  2,  "title":  "child epic",  "group_id":  49,  "parent_id":  23,  "has_children":  false,  "has_issues":  false,  "reference":  "&2",  "url":  "http://localhost/groups/group16/-/epics/2",  "relation_url":  "http://localhost/groups/group16/-/epics/1/links/24"  } 
```

## Re-order a child epic[](#re-order-a-child-epic "Permalink")

```
PUT /groups/:id/epics/:epic_iid/epics/:child_epic_id 
```

| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer/string | yes | 认证用户拥有[的组](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding) . |
| `epic_iid` | integer | yes | 史诗的内部 ID. |
| `child_epic_id` | integer | yes | 子史诗的全局 ID. 内部 ID 无法使用,因为它们可能与其他组的史诗冲突. |
| `move_before_id` | integer | no | 同胞史诗的全局 ID,应放在子史诗之前. |
| `move_after_id` | integer | no | 同胞史诗的全局 ID,应放在子史诗之后. |

```
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/epics/4/epics/5" 
```

响应示例:

```
[  {  "id":  29,  "iid":  6,  "group_id":  1,  "parent_id":  5,  "title":  "Accusamus iste et ullam ratione voluptatem omnis debitis dolor est.",  "description":  "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",  "author":  {  "id":  10,  "name":  "Lu Mayer",  "username":  "kam",  "state":  "active",  "avatar_url":  "http://www.gravatar.com/avatar/018729e129a6f31c80a6327a30196823?s=80&d=identicon",  "web_url":  "http://localhost:3001/kam"  },  "start_date":  null,  "start_date_is_fixed":  false,  "start_date_fixed":  null,  "start_date_from_milestones":  null,  //deprecated  in  favor  of  start_date_from_inherited_source  "start_date_from_inherited_source":  null,  "end_date":  "2018-07-31",  //deprecated  in  favor  of  due_date  "due_date":  "2018-07-31",  "due_date_is_fixed":  false,  "due_date_fixed":  null,  "due_date_from_milestones":  "2018-07-31",  //deprecated  in  favor  of  start_date_from_inherited_source  "due_date_from_inherited_source":  "2018-07-31",  "created_at":  "2018-07-17T13:36:22.770Z",  "updated_at":  "2018-07-18T12:22:05.239Z",  "labels":  []  }  ] 
```

## Unassign a child epic[](#unassign-a-child-epic "Permalink")

从父级史诗中取消分配子级史诗.

```
DELETE /groups/:id/epics/:epic_iid/epics/:child_epic_id 
```

| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer/string | yes | 认证用户拥有[的组](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding) . |
| `epic_iid` | integer | yes | 史诗的内部 ID. |
| `child_epic_id` | integer | yes | 子史诗的全局 ID. 内部 ID 无法使用,因为它们可能与其他组的史诗冲突. |

```
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/epics/4/epics/5" 
```

响应示例:

```
{  "id":  5,  "iid":  38,  "group_id":  1,  "parent_id":  null,  "title":  "Accusamus iste et ullam ratione voluptatem omnis debitis dolor est.",  "description":  "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",  "author":  {  "id":  10,  "name":  "Lu Mayer",  "username":  "kam",  "state":  "active",  "avatar_url":  "http://www.gravatar.com/avatar/018729e129a6f31c80a6327a30196823?s=80&d=identicon",  "web_url":  "http://localhost:3001/kam"  },  "start_date":  null,  "start_date_is_fixed":  false,  "start_date_fixed":  null,  "start_date_from_milestones":  null,  //deprecated  in  favor  of  start_date_from_inherited_source  "start_date_from_inherited_source":  null,  "end_date":  "2018-07-31",  //deprecated  in  favor  of  due_date  "due_date":  "2018-07-31",  "due_date_is_fixed":  false,  "due_date_fixed":  null,  "due_date_from_milestones":  "2018-07-31",  //deprecated  in  favor  of  start_date_from_inherited_source  "due_date_from_inherited_source":  "2018-07-31",  "created_at":  "2018-07-17T13:36:22.770Z",  "updated_at":  "2018-07-18T12:22:05.239Z",  "labels":  []  } 
```