Pipeline triggers API
- List project triggers
- Get trigger details
- Create a project trigger
- Update a project trigger
- Remove a project trigger
Pipeline triggers API
您可以阅读有关通过 API 触发管道的更多信息.
List project triggers
获取项目的构建触发器的列表.
GET /projects/:id/triggers
Attribute | Type | required | Description |
---|---|---|---|
id |
integer/string | yes | 经过身份验证的用户拥有的项目的 ID 或URL 编码路径 |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/triggers"
[ { "id": 10, "description": "my trigger", "created_at": "2016-01-07T09:53:58.235Z", "last_used": null, "token": "6d056f63e50fe6f8c5f8f4aa10edb7", "updated_at": "2016-01-07T09:53:58.235Z", "owner": null } ]
Get trigger details
获取项目构建触发器的详细信息.
GET /projects/:id/triggers/:trigger_id
Attribute | Type | required | Description |
---|---|---|---|
id |
integer/string | yes | 经过身份验证的用户拥有的项目的 ID 或URL 编码路径 |
trigger_id |
integer | yes | 触发 ID |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/triggers/5"
{ "id": 10, "description": "my trigger", "created_at": "2016-01-07T09:53:58.235Z", "last_used": null, "token": "6d056f63e50fe6f8c5f8f4aa10edb7", "updated_at": "2016-01-07T09:53:58.235Z", "owner": null }
Create a project trigger
为项目创建触发器.
POST /projects/:id/triggers
Attribute | Type | required | Description |
---|---|---|---|
id |
integer/string | yes | 经过身份验证的用户拥有的项目的 ID 或URL 编码路径 |
description |
string | yes | 触发名称 |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form description="my description" "https://gitlab.example.com/api/v4/projects/1/triggers"
{ "id": 10, "description": "my trigger", "created_at": "2016-01-07T09:53:58.235Z", "last_used": null, "token": "6d056f63e50fe6f8c5f8f4aa10edb7", "updated_at": "2016-01-07T09:53:58.235Z", "owner": null }
Update a project trigger
更新项目的触发器.
PUT /projects/:id/triggers/:trigger_id
Attribute | Type | required | Description |
---|---|---|---|
id |
integer/string | yes | 经过身份验证的用户拥有的项目的 ID 或URL 编码路径 |
trigger_id |
integer | yes | 触发 ID |
description |
string | no | 触发名称 |
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" --form description="my description" "https://gitlab.example.com/api/v4/projects/1/triggers/10"
{ "id": 10, "description": "my trigger", "created_at": "2016-01-07T09:53:58.235Z", "last_used": null, "token": "6d056f63e50fe6f8c5f8f4aa10edb7", "updated_at": "2016-01-07T09:53:58.235Z", "owner": null }
Remove a project trigger
删除项目的生成触发器.
DELETE /projects/:id/triggers/:trigger_id
Attribute | Type | required | Description |
---|---|---|---|
id |
integer/string | yes | 经过身份验证的用户拥有的项目的 ID 或URL 编码路径 |
trigger_id |
integer | yes | 触发 ID |
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/triggers/5"