gitlab-org--gitlab-foss/doc/ci/api/projects.md

149 lines
3.2 KiB
Markdown
Raw Normal View History

2015-08-25 21:42:46 -04:00
# Projects API
This API is intended to aid in the setup and configuration of
2015-10-31 18:31:21 -04:00
projects on GitLab CI.
2015-08-25 21:42:46 -04:00
__Authentication is done by GitLab user token & GitLab url__
## Projects
### List Authorized Projects
Lists all projects that the authenticated user has access to.
```
2015-09-15 18:28:59 -04:00
GET /ci/projects
2015-08-25 21:42:46 -04:00
```
Returns:
```json
[
{
"id" : 271,
"name" : "gitlabhq",
"timeout" : 1800,
"token" : "iPWx6WM4lhHNedGfBpPJNP",
"default_ref" : "master",
"gitlab_url" : "http://demo.gitlabhq.com/gitlab/gitlab-shell",
"path" : "gitlab/gitlab-shell",
"always_build" : false,
"polling_interval" : null,
"public" : false,
"ssh_url_to_repo" : "git@demo.gitlab.com:gitlab/gitlab-shell.git",
"gitlab_id" : 3
},
{
"id" : 272,
"name" : "gitlab-ci",
"timeout" : 1800,
"token" : "iPWx6WM4lhHNedGfBpPJNP",
"default_ref" : "master",
"gitlab_url" : "http://demo.gitlabhq.com/gitlab/gitlab-shell",
"path" : "gitlab/gitlab-shell",
"always_build" : false,
"polling_interval" : null,
"public" : false,
"ssh_url_to_repo" : "git@demo.gitlab.com:gitlab/gitlab-shell.git",
"gitlab_id" : 4
}
]
```
### List Owned Projects
Lists all projects that the authenticated user owns.
```
2015-09-15 18:28:59 -04:00
GET /ci/projects/owned
2015-08-25 21:42:46 -04:00
```
Returns:
```json
[
{
"id" : 272,
"name" : "gitlab-ci",
"timeout" : 1800,
"token" : "iPWx6WM4lhHNedGfBpPJNP",
"default_ref" : "master",
"gitlab_url" : "http://demo.gitlabhq.com/gitlab/gitlab-shell",
"path" : "gitlab/gitlab-shell",
"always_build" : false,
"polling_interval" : null,
"public" : false,
"ssh_url_to_repo" : "git@demo.gitlab.com:gitlab/gitlab-shell.git",
"gitlab_id" : 4
}
]
```
### Single Project
Returns information about a single project for which the user is
authorized.
2015-09-15 18:28:59 -04:00
GET /ci/projects/:id
2015-08-25 21:42:46 -04:00
Parameters:
2015-10-31 18:31:21 -04:00
* `id` (required) - The ID of the GitLab CI project
2015-08-25 21:42:46 -04:00
### Create Project
2015-10-31 18:31:21 -04:00
Creates a GitLab CI project using GitLab project details.
2015-08-25 21:42:46 -04:00
2015-09-15 18:28:59 -04:00
POST /ci/projects
2015-08-25 21:42:46 -04:00
Parameters:
* `name` (required) - The name of the project
2015-10-31 18:31:21 -04:00
* `gitlab_id` (required) - The ID of the project on the GitLab instance
2015-08-25 21:42:46 -04:00
* `default_ref` (optional) - The branch to run on (default to `master`)
### Update Project
2015-10-31 18:31:21 -04:00
Updates a GitLab CI project using GitLab project details that the
2015-08-25 21:42:46 -04:00
authenticated user has access to.
2015-09-15 18:28:59 -04:00
PUT /ci/projects/:id
2015-08-25 21:42:46 -04:00
Parameters:
* `name` - The name of the project
* `default_ref` - The branch to run on (default to `master`)
### Remove Project
2015-10-31 18:31:21 -04:00
Removes a GitLab CI project that the authenticated user has access to.
2015-08-25 21:42:46 -04:00
2015-09-15 18:28:59 -04:00
DELETE /ci/projects/:id
2015-08-25 21:42:46 -04:00
Parameters:
2015-10-31 18:31:21 -04:00
* `id` (required) - The ID of the GitLab CI project
2015-08-25 21:42:46 -04:00
### Link Project to Runner
Links a runner to a project so that it can make builds (only via
authorized user).
2015-09-15 18:28:59 -04:00
POST /ci/projects/:id/runners/:runner_id
2015-08-25 21:42:46 -04:00
Parameters:
2015-10-31 18:31:21 -04:00
* `id` (required) - The ID of the GitLab CI project
* `runner_id` (required) - The ID of the GitLab CI runner
2015-08-25 21:42:46 -04:00
### Remove Project from Runner
Removes a runner from a project so that it can not make builds (only
via authorized user).
2015-09-15 18:28:59 -04:00
DELETE /ci/projects/:id/runners/:runner_id
2015-08-25 21:42:46 -04:00
Parameters:
2015-10-31 18:31:21 -04:00
* `id` (required) - The ID of the GitLab CI project
* `runner_id` (required) - The ID of the GitLab CI runner