Pipeline triggers API

原文:https://docs.gitlab.com/ee/api/pipeline_triggers.html

Pipeline triggers API

您可以阅读有关通过 API 触发管道的更多信息.

List project triggers

获取项目的构建触发器的列表.

  1. GET /projects/:id/triggers
Attribute Type required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
  1. curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/triggers"
  1. [ { "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

获取项目构建触发器的详细信息.

  1. GET /projects/:id/triggers/:trigger_id
Attribute Type required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
trigger_id integer yes 触发 ID
  1. curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/triggers/5"
  1. { "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

为项目创建触发器.

  1. POST /projects/:id/triggers
Attribute Type required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
description string yes 触发名称
  1. curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form description="my description" "https://gitlab.example.com/api/v4/projects/1/triggers"
  1. { "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

更新项目的触发器.

  1. PUT /projects/:id/triggers/:trigger_id
Attribute Type required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
trigger_id integer yes 触发 ID
description string no 触发名称
  1. curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" --form description="my description" "https://gitlab.example.com/api/v4/projects/1/triggers/10"
  1. { "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

删除项目的生成触发器.

  1. DELETE /projects/:id/triggers/:trigger_id
Attribute Type required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
trigger_id integer yes 触发 ID
  1. curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/triggers/5"