Help us learn about your current experience with the documentation. Take the survey.

项目迭代 API

  • 版本:Premium, Ultimate
  • 产品:GitLab.com, GitLab Self-Managed, GitLab Dedicated

本页面介绍了项目迭代 API。 还有一个独立的 群组迭代 API 页面。

我们不再有项目级别的迭代,但您可以使用此端点来获取项目所属的上级群组的迭代。

列出项目迭代

返回项目迭代列表。

通过 迭代周期 中的 启用自动调度 创建的迭代,其 titledescription 字段将返回 null

GET /projects/:id/iterations
GET /projects/:id/iterations?state=opened
GET /projects/:id/iterations?state=closed
GET /projects/:id/iterations?search=version
GET /projects/:id/iterations?include_ancestors=false
GET /projects/:id/iterations?include_descendants=true
GET /projects/:id/iterations?updated_before=2013-10-02T09%3A24%3A18Z
GET /projects/:id/iterations?updated_after=2013-10-02T09%3A24%3A18Z
属性 类型 必需 描述
state string 返回 opened(已开启)、upcoming(即将开始)、current(当前)、closed(已关闭)或 all(全部)状态的迭代。
search string 仅返回标题与提供的字符串匹配的迭代。
in string 数组 使用 search 参数中提供的查询进行模糊搜索的字段。可用选项为 titlecadence_title。默认值为 [title]。于 GitLab 16.2 引入
include_ancestors boolean 包含父群组及其上级群组的迭代。默认为 true
include_descendants boolean 包含父群组及其后代群组的迭代。默认为 false。于 GitLab 16.7 引入
updated_before datetime 仅返回在给定日期时间之前更新的迭代。日期时间格式应为 ISO 8601 (2019-03-15T08:00:00Z)。于 GitLab 15.10 引入
updated_after datetime 仅返回在给定日期时间之后更新的迭代。日期时间格式应为 ISO 8601 (2019-03-15T08:00:00Z)。于 GitLab 15.10 引入

请求示例:

curl --request GET \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/iterations"

响应示例:

[
  {
    "id": 53,
    "iid": 13,
    "group_id": 5,
    "title": "Iteration II",
    "description": "Ipsum Lorem ipsum",
    "state": 2,
    "created_at": "2020-01-27T05:07:12.573Z",
    "updated_at": "2020-01-27T05:07:12.573Z",
    "due_date": "2020-02-01",
    "start_date": "2020-02-14",
    "web_url": "http://gitlab.example.com/groups/my-group/-/iterations/13"
  }
]