gitlab-org--gitlab-foss/doc/api/pipeline_triggers.md
Yorick Peterse d0b8f536a1
Remove soft removals related code
This removes all usage of soft removals except for the "pending delete"
system implemented for projects. This in turn simplifies all the query
plans of the models that used soft removals. Since we don't really use
soft removals for anything useful there's no point in keeping it around.

This _does_ mean that hard removals of issues (which only admins can do
if I'm not mistaken) can influence the "iid" values, but that code is
broken to begin with. More on this (and how to fix it) can be found in
https://gitlab.com/gitlab-org/gitlab-ce/issues/31114.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/37447
2018-01-08 17:04:45 +01:00

5 KiB

Pipeline triggers API

You can read more about triggering pipelines through the API.

List project triggers

Get a list of project's build triggers.

GET /projects/:id/triggers
Attribute Type required Description
id integer/string yes The ID or URL-encoded path of the project owned by the authenticated user
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "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 details of project's build trigger.

GET /projects/:id/triggers/:trigger_id
Attribute Type required Description
id integer/string yes The ID or URL-encoded path of the project owned by the authenticated user
trigger_id integer yes The trigger id
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "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 trigger for a project.

POST /projects/:id/triggers
Attribute Type required Description
id integer/string yes The ID or URL-encoded path of the project owned by the authenticated user
description string yes The trigger name
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" --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 trigger for a project.

PUT /projects/:id/triggers/:trigger_id
Attribute Type required Description
id integer/string yes The ID or URL-encoded path of the project owned by the authenticated user
trigger_id integer yes The trigger id
description string no The trigger name
curl --request PUT --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" --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
}

Take ownership of a project trigger

Update an owner of a project trigger.

POST /projects/:id/triggers/:trigger_id/take_ownership
Attribute Type required Description
id integer/string yes The ID or URL-encoded path of the project owned by the authenticated user
trigger_id integer yes The trigger id
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/triggers/10/take_ownership"
{
    "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
id integer/string yes The ID or URL-encoded path of the project owned by the authenticated user
trigger_id integer yes The trigger id
curl --request DELETE --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/triggers/5"