企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# Pipeline triggers API > 原文:[https://docs.gitlab.com/ee/api/pipeline_triggers.html](https://docs.gitlab.com/ee/api/pipeline_triggers.html) * [List project triggers](#list-project-triggers) * [Get trigger details](#get-trigger-details) * [Create a project trigger](#create-a-project-trigger) * [Update a project trigger](#update-a-project-trigger) * [Remove a project trigger](#remove-a-project-trigger) # Pipeline triggers API[](#pipeline-triggers-api "Permalink") 您可以阅读有关[通过 API 触发管道的](../ci/triggers/README.html)更多信息. ## List project triggers[](#list-project-triggers "Permalink") 获取项目的构建触发器的列表. ``` GET /projects/:id/triggers ``` | Attribute | Type | required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 经过身份验证的用户拥有[的项目](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding) | ``` 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-trigger-details "Permalink") 获取项目构建触发器的详细信息. ``` GET /projects/:id/triggers/:trigger_id ``` | Attribute | Type | required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 经过身份验证的用户拥有[的项目](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding) | | `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[](#create-a-project-trigger "Permalink") 为项目创建触发器. ``` POST /projects/:id/triggers ``` | Attribute | Type | required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 经过身份验证的用户拥有[的项目](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding) | | `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[](#update-a-project-trigger "Permalink") 更新项目的触发器. ``` PUT /projects/:id/triggers/:trigger_id ``` | Attribute | Type | required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 经过身份验证的用户拥有[的项目](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding) | | `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[](#remove-a-project-trigger "Permalink") 删除项目的生成触发器. ``` DELETE /projects/:id/triggers/:trigger_id ``` | Attribute | Type | required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 经过身份验证的用户拥有[的项目](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding) | | `trigger_id` | integer | yes | 触发 ID | ``` curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/triggers/5" ```