Freeze Periods API
- Permissions and security
- List Freeze Periods
- Get a Freeze Period by a
freeze_period_id
- Create a Freeze Period
- Update a Freeze Period
- Delete a Freeze Period
Freeze Periods API
在 GitLab 13.0 中引入 .
您可以使用 Freeze Periods API 来操纵 GitLab 的Freeze Period条目.
Permissions and security
只有具有维护者权限的用户才能与 Freeze Period API 端点进行交互.
List Freeze Periods
冻结期间的分页列表,按created_at
升序排序.
GET /projects/:id/freeze_periods
Attribute | Type | Required | Description |
---|---|---|---|
id |
integer/string | yes | 项目的 ID 或URL 编码的路径 . |
请求示例:
curl --header "PRIVATE-TOKEN: gVWYVHDRzXiRpN1rUC8T" "https://gitlab.example.com/api/v4/projects/19/freeze_periods"
响应示例:
[ { "id":1, "freeze_start":"0 23 * * 5", "freeze_end":"0 8 * * 1", "cron_timezone":"UTC", "created_at":"2020-05-15T17:03:35.702Z", "updated_at":"2020-05-15T17:06:41.566Z" } ]
Get a Freeze Period by a freeze_period_id
获取给定的freeze_period_id
的冻结期.
GET /projects/:id/freeze_periods/:freeze_period_id
Attribute | Type | Required | Description |
---|---|---|---|
id |
整数或字符串 | yes | 项目的 ID 或URL 编码的路径 . |
freeze_period_id |
string | yes | 冻结期的数据库 ID. |
请求示例:
curl --header "PRIVATE-TOKEN: gVWYVHDRzXiRpN1rUC8T" "https://gitlab.example.com/api/v4/projects/19/freeze_periods/1"
响应示例:
{ "id":1, "freeze_start":"0 23 * * 5", "freeze_end":"0 8 * * 1", "cron_timezone":"UTC", "created_at":"2020-05-15T17:03:35.702Z", "updated_at":"2020-05-15T17:06:41.566Z" }
Create a Freeze Period
创建冻结期.
POST /projects/:id/freeze_periods
Attribute | Type | Required | Description |
---|---|---|---|
id |
整数或字符串 | yes | 项目的 ID 或URL 编码的路径 . |
freeze_start |
string | yes | Cron格式的冻结期开始. |
freeze_end |
string | yes | Cron格式的冻结期结束. |
cron_timezone |
string | no | cron 字段的时区,如果未提供,则默认为 UTC. |
请求示例:
curl --header 'Content-Type: application/json' --header "PRIVATE-TOKEN: gVWYVHDRzXiRpN1rUC8T" \
--data '{ "freeze_start": "0 23 * * 5", "freeze_end": "0 7 * * 1", "cron_timezone": "UTC" }' \
--request POST https://gitlab.example.com/api/v4/projects/19/freeze_periods
响应示例:
{ "id":1, "freeze_start":"0 23 * * 5", "freeze_end":"0 7 * * 1", "cron_timezone":"UTC", "created_at":"2020-05-15T17:03:35.702Z", "updated_at":"2020-05-15T17:03:35.702Z" }
Update a Freeze Period
为给定的freeze_period_id
更新冻结期.
PUT /projects/:id/freeze_periods/:tag_name
Attribute | Type | Required | Description |
---|---|---|---|
id |
整数或字符串 | yes | 项目的 ID 或URL 编码的路径 . |
freeze_period_id |
整数或字符串 | yes | 冻结期的数据库 ID. |
freeze_start |
string | no | Cron格式的冻结期开始. |
freeze_end |
string | no | Cron格式的冻结期结束. |
cron_timezone |
string | no | cron 字段的时区. |
请求示例:
curl --header 'Content-Type: application/json' --header "PRIVATE-TOKEN: gVWYVHDRzXiRpN1rUC8T" \
--data '{ "freeze_end": "0 8 * * 1" }' \
--request PUT https://gitlab.example.com/api/v4/projects/19/freeze_periods/1
响应示例:
{ "id":1, "freeze_start":"0 23 * * 5", "freeze_end":"0 8 * * 1", "cron_timezone":"UTC", "created_at":"2020-05-15T17:03:35.702Z", "updated_at":"2020-05-15T17:06:41.566Z" }
Delete a Freeze Period
删除给定的freeze_period_id
的冻结期.
DELETE /projects/:id/freeze_periods/:freeze_period_id
Attribute | Type | Required | Description |
---|---|---|---|
id |
整数或字符串 | yes | 项目的 ID 或URL 编码的路径 . |
freeze_period_id |
string | yes | 冻结期的数据库 ID. |
请求示例:
curl --request DELETE --header "PRIVATE-TOKEN: gVWYVHDRzXiRpN1rUC8T" "https://gitlab.example.com/api/v4/projects/19/freeze_periods/1"