2017-05-18 04:49:03 -04:00
|
|
|
# Pipeline triggers API
|
2017-03-05 15:18:00 -05:00
|
|
|
|
|
|
|
You can read more about [triggering pipelines through the API](../ci/triggers/README.md).
|
|
|
|
|
|
|
|
## List project triggers
|
|
|
|
|
|
|
|
Get a list of project's build triggers.
|
|
|
|
|
|
|
|
```
|
|
|
|
GET /projects/:id/triggers
|
|
|
|
```
|
|
|
|
|
|
|
|
| Attribute | Type | required | Description |
|
|
|
|
|-----------|---------|----------|---------------------|
|
2017-04-08 05:21:11 -04:00
|
|
|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
|
2017-03-05 15:18:00 -05:00
|
|
|
|
|
|
|
```
|
2018-12-27 04:03:08 -05:00
|
|
|
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/triggers"
|
2017-03-05 15:18:00 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
```json
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"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 details of project's build trigger.
|
|
|
|
|
|
|
|
```
|
|
|
|
GET /projects/:id/triggers/:trigger_id
|
|
|
|
```
|
|
|
|
|
2017-03-22 08:18:06 -04:00
|
|
|
| Attribute | Type | required | Description |
|
|
|
|
|--------------|---------|----------|--------------------------|
|
2017-04-08 05:21:11 -04:00
|
|
|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
|
2017-03-22 08:18:06 -04:00
|
|
|
| `trigger_id` | integer | yes | The trigger id |
|
2017-03-05 15:18:00 -05:00
|
|
|
|
|
|
|
```
|
2018-12-27 04:03:08 -05:00
|
|
|
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/triggers/5"
|
2017-03-05 15:18:00 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"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 trigger for a project.
|
|
|
|
|
|
|
|
```
|
|
|
|
POST /projects/:id/triggers
|
|
|
|
```
|
|
|
|
|
|
|
|
| Attribute | Type | required | Description |
|
|
|
|
|---------------|---------|----------|--------------------------|
|
2017-04-08 05:21:11 -04:00
|
|
|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
|
2017-03-05 15:18:00 -05:00
|
|
|
| `description` | string | yes | The trigger name |
|
|
|
|
|
|
|
|
```
|
2018-12-27 04:03:08 -05:00
|
|
|
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form description="my description" "https://gitlab.example.com/api/v4/projects/1/triggers"
|
2017-03-05 15:18:00 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"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 trigger for a project.
|
|
|
|
|
|
|
|
```
|
|
|
|
PUT /projects/:id/triggers/:trigger_id
|
|
|
|
```
|
|
|
|
|
|
|
|
| Attribute | Type | required | Description |
|
|
|
|
|---------------|---------|----------|--------------------------|
|
2017-04-08 05:21:11 -04:00
|
|
|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
|
2017-03-05 15:18:00 -05:00
|
|
|
| `trigger_id` | integer | yes | The trigger id |
|
|
|
|
| `description` | string | no | The trigger name |
|
|
|
|
|
|
|
|
```
|
2018-12-27 04:03:08 -05:00
|
|
|
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" --form description="my description" "https://gitlab.example.com/api/v4/projects/1/triggers/10"
|
2017-03-05 15:18:00 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"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
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Take ownership of a project trigger
|
|
|
|
|
|
|
|
Update an owner of a project trigger.
|
|
|
|
|
|
|
|
```
|
2017-03-06 06:00:15 -05:00
|
|
|
POST /projects/:id/triggers/:trigger_id/take_ownership
|
2017-03-05 15:18:00 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
| Attribute | Type | required | Description |
|
|
|
|
|---------------|---------|----------|--------------------------|
|
2017-04-08 05:21:11 -04:00
|
|
|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
|
2017-03-05 15:18:00 -05:00
|
|
|
| `trigger_id` | integer | yes | The trigger id |
|
|
|
|
|
|
|
|
```
|
2018-12-27 04:03:08 -05:00
|
|
|
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/triggers/10/take_ownership"
|
2017-03-05 15:18:00 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"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's build trigger.
|
|
|
|
|
|
|
|
```
|
|
|
|
DELETE /projects/:id/triggers/:trigger_id
|
|
|
|
```
|
|
|
|
|
|
|
|
| Attribute | Type | required | Description |
|
|
|
|
|----------------|---------|----------|--------------------------|
|
2017-04-08 05:21:11 -04:00
|
|
|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
|
2017-03-05 15:18:00 -05:00
|
|
|
| `trigger_id` | integer | yes | The trigger id |
|
|
|
|
|
|
|
|
```
|
2018-12-27 04:03:08 -05:00
|
|
|
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/triggers/5"
|
2017-03-05 15:18:00 -05:00
|
|
|
```
|