projects.md 37.8 KB
Newer Older
1
# Projects API
2

3 4 5
### Project visibility level

Project in GitLab has be either private, internal or public.
6
You can determine it by `visibility` field in project.
7 8 9

Constants for project visibility levels are next:

10
* `private`:
11 12
  Project access must be granted explicitly for each user.

13
* `internal`:
14
  The project can be cloned by any logged in user.
15

16
* `public`:
17 18
  The project can be cloned without any authentication.

19
## List projects
N
Nihad Abbasov 已提交
20

21
Get a list of visible projects for authenticated user. When being accessed without authentication, all public projects are returned.
N
Nihad Abbasov 已提交
22 23 24 25 26

```
GET /projects
```

27 28
Parameters:

29 30 31 32 33 34
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `archived` | boolean | no | Limit by archived status |
| `visibility` | string | no | Limit by visibility `public`, `internal`, or `private` |
| `order_by` | string | no | Return projects ordered by `id`, `name`, `path`, `created_at`, `updated_at`, or `last_activity_at` fields. Default is `created_at` |
| `sort` | string | no | Return projects sorted in `asc` or `desc` order. Default is `desc` |
35
| `search` | string | no | Return list of projects matching the search criteria |
36
| `simple` | boolean | no | Return only the ID, URL, name, and path of each project |
T
Toon Claes 已提交
37
| `owned` | boolean | no | Limit by projects owned by the current user |
38
| `membership` | boolean | no | Limit by projects that the current user is a member of |
T
Toon Claes 已提交
39
| `starred` | boolean | no | Limit by projects starred by the current user |
40
| `statistics` | boolean | no | Include project statistics |
41 42
| `with_issues_enabled` | boolean | no | Limit by enabled issues feature |
| `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature |
43

N
Nihad Abbasov 已提交
44 45 46
```json
[
  {
M
Marin Jankovski 已提交
47
    "id": 4,
N
Nihad Abbasov 已提交
48 49
    "description": null,
    "default_branch": "master",
50
    "visibility": "private",
M
Marin Jankovski 已提交
51 52 53
    "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git",
    "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git",
    "web_url": "http://example.com/diaspora/diaspora-client",
54 55 56 57
    "tag_list": [
      "example",
      "disapora client"
    ],
N
Nihad Abbasov 已提交
58
    "owner": {
M
Marin Jankovski 已提交
59 60
      "id": 3,
      "name": "Diaspora",
B
Ben Boeckel 已提交
61
      "created_at": "2013-09-30T13:46:02Z"
N
Nihad Abbasov 已提交
62
    },
M
Marin Jankovski 已提交
63 64 65 66 67
    "name": "Diaspora Client",
    "name_with_namespace": "Diaspora / Diaspora Client",
    "path": "diaspora-client",
    "path_with_namespace": "diaspora/diaspora-client",
    "issues_enabled": true,
S
Stan Hu 已提交
68
    "open_issues_count": 1,
M
Marin Jankovski 已提交
69
    "merge_requests_enabled": true,
70
    "jobs_enabled": true,
N
Nihad Abbasov 已提交
71
    "wiki_enabled": true,
M
Marin Jankovski 已提交
72
    "snippets_enabled": false,
73
    "container_registry_enabled": false,
B
Ben Boeckel 已提交
74 75
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
76
    "creator_id": 3,
M
Marin Jankovski 已提交
77 78 79 80
    "namespace": {
      "id": 3,
      "name": "Diaspora",
      "path": "diaspora",
81 82
      "kind": "group",
      "full_path": "diaspora"
83
    },
S
sue445 已提交
84
    "archived": false,
T
Tomasz Maczukin 已提交
85 86 87
    "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png",
    "shared_runners_enabled": true,
    "forks_count": 0,
88 89
    "star_count": 0,
    "runners_token": "b8547b1dc37721d05889db52fa2f02",
90
    "public_jobs": true,
91
    "shared_with_groups": [],
J
James Lopez 已提交
92
    "only_allow_merge_if_pipeline_succeeds": false,
93
    "only_allow_merge_if_all_discussions_are_resolved": false,
94 95 96 97 98 99 100 101
    "request_access_enabled": false,
    "statistics": {
      "commit_count": 37,
      "storage_size": 1038090,
      "repository_size": 1038090,
      "lfs_objects_size": 0,
      "job_artifacts_size": 0
    }
N
Nihad Abbasov 已提交
102 103
  },
  {
M
Marin Jankovski 已提交
104
    "id": 6,
N
Nihad Abbasov 已提交
105
    "description": null,
M
Marin Jankovski 已提交
106
    "default_branch": "master",
107
    "visibility": "private",
M
Marin Jankovski 已提交
108 109 110
    "ssh_url_to_repo": "git@example.com:brightbox/puppet.git",
    "http_url_to_repo": "http://example.com/brightbox/puppet.git",
    "web_url": "http://example.com/brightbox/puppet",
111 112 113 114
    "tag_list": [
      "example",
      "puppet"
    ],
J
Johannes Schleifenbaum 已提交
115
    "owner": {
M
Marin Jankovski 已提交
116 117 118
      "id": 4,
      "name": "Brightbox",
      "created_at": "2013-09-30T13:46:02Z"
N
Nihad Abbasov 已提交
119
    },
M
Marin Jankovski 已提交
120 121 122 123
    "name": "Puppet",
    "name_with_namespace": "Brightbox / Puppet",
    "path": "puppet",
    "path_with_namespace": "brightbox/puppet",
N
Nihad Abbasov 已提交
124
    "issues_enabled": true,
S
Stan Hu 已提交
125
    "open_issues_count": 1,
N
Nihad Abbasov 已提交
126
    "merge_requests_enabled": true,
127
    "jobs_enabled": true,
N
Nihad Abbasov 已提交
128
    "wiki_enabled": true,
M
Marin Jankovski 已提交
129
    "snippets_enabled": false,
130
    "container_registry_enabled": false,
M
Marin Jankovski 已提交
131 132
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
133
    "creator_id": 3,
J
Johannes Schleifenbaum 已提交
134
    "namespace": {
M
Marin Jankovski 已提交
135 136 137
      "id": 4,
      "name": "Brightbox",
      "path": "brightbox",
138 139
      "kind": "group",
      "full_path": "brightbox"
140
    },
141 142 143 144 145 146 147 148 149 150
    "permissions": {
      "project_access": {
        "access_level": 10,
        "notification_level": 3
      },
      "group_access": {
        "access_level": 50,
        "notification_level": 3
      }
    },
S
sue445 已提交
151
    "archived": false,
T
Tomasz Maczukin 已提交
152 153 154 155
    "avatar_url": null,
    "shared_runners_enabled": true,
    "forks_count": 0,
    "star_count": 0,
156
    "runners_token": "b8547b1dc37721d05889db52fa2f02",
157
    "public_jobs": true,
158
    "shared_with_groups": [],
J
James Lopez 已提交
159
    "only_allow_merge_if_pipeline_succeeds": false,
160
    "only_allow_merge_if_all_discussions_are_resolved": false,
161 162 163 164 165 166 167 168
    "request_access_enabled": false,
    "statistics": {
      "commit_count": 12,
      "storage_size": 2066080,
      "repository_size": 2066080,
      "lfs_objects_size": 0,
      "job_artifacts_size": 0
    }
N
Nihad Abbasov 已提交
169 170 171 172
  }
]
```

173
### Get single project
N
Nihad Abbasov 已提交
174

175 176
Get a specific project. This endpoint can be accessed without authentication if
the project is publicly accessible.
N
Nihad Abbasov 已提交
177 178 179 180 181 182 183

```
GET /projects/:id
```

Parameters:

184 185
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
186
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
187
| `statistics` | boolean | no | Include project statistics |
N
Nihad Abbasov 已提交
188

A
Alex Denisov 已提交
189 190
```json
{
M
Marin Jankovski 已提交
191
  "id": 3,
A
Alex Denisov 已提交
192
  "description": null,
M
Marin Jankovski 已提交
193
  "default_branch": "master",
194
  "visibility": "private",
M
Marin Jankovski 已提交
195 196 197
  "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git",
  "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
  "web_url": "http://example.com/diaspora/diaspora-project-site",
198 199 200 201
  "tag_list": [
    "example",
    "disapora project"
  ],
A
Alex Denisov 已提交
202
  "owner": {
M
Marin Jankovski 已提交
203 204
    "id": 3,
    "name": "Diaspora",
B
Ben Boeckel 已提交
205
    "created_at": "2013-09-30T13:46:02Z"
A
Alex Denisov 已提交
206
  },
M
Marin Jankovski 已提交
207 208 209 210
  "name": "Diaspora Project Site",
  "name_with_namespace": "Diaspora / Diaspora Project Site",
  "path": "diaspora-project-site",
  "path_with_namespace": "diaspora/diaspora-project-site",
A
Alex Denisov 已提交
211
  "issues_enabled": true,
S
Stan Hu 已提交
212
  "open_issues_count": 1,
A
Alex Denisov 已提交
213
  "merge_requests_enabled": true,
214
  "jobs_enabled": true,
A
Alex Denisov 已提交
215
  "wiki_enabled": true,
M
Marin Jankovski 已提交
216
  "snippets_enabled": false,
217
  "container_registry_enabled": false,
B
Ben Boeckel 已提交
218 219
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
220
  "creator_id": 3,
M
Marin Jankovski 已提交
221 222 223 224
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
225 226
    "kind": "group",
    "full_path": "diaspora"
J
Johannes Schleifenbaum 已提交
227
  },
D
Dmitriy Zaporozhets 已提交
228 229 230 231 232 233 234 235 236
  "permissions": {
    "project_access": {
      "access_level": 10,
      "notification_level": 3
    },
    "group_access": {
      "access_level": 50,
      "notification_level": 3
    }
237
  },
S
sue445 已提交
238
  "archived": false,
T
Tomasz Maczukin 已提交
239 240 241 242
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
  "shared_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
243
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
244
  "public_jobs": true,
245 246 247 248 249 250 251 252 253 254 255
  "shared_with_groups": [
    {
      "group_id": 4,
      "group_name": "Twitter",
      "group_access_level": 30
    },
    {
      "group_id": 3,
      "group_name": "Gitlab Org",
      "group_access_level": 10
    }
256
  ],
J
James Lopez 已提交
257
  "only_allow_merge_if_pipeline_succeeds": false,
258
  "only_allow_merge_if_all_discussions_are_resolved": false,
259 260 261 262 263 264 265 266
  "request_access_enabled": false,
  "statistics": {
    "commit_count": 37,
    "storage_size": 1038090,
    "repository_size": 1038090,
    "lfs_objects_size": 0,
    "job_artifacts_size": 0
  }
A
Alex Denisov 已提交
267 268 269
}
```

270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
## Get project users

Get the users list of a project.


Parameters:

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `search` | string | no | Search for specific users |

```
GET /projects/:id/users
```

```json
[
  {
    "id": 1,
    "username": "john_smith",
    "name": "John Smith",
    "state": "active",
    "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
    "web_url": "http://localhost:3000/john_smith"
  },
  {
    "id": 2,
    "username": "jack_smith",
    "name": "Jack Smith",
    "state": "blocked",
    "avatar_url": "http://gravatar.com/../e32131cd8.jpeg",
    "web_url": "http://localhost:3000/jack_smith"
  }
]
```

D
Dmitriy Zaporozhets 已提交
306 307
### Get project events

308 309 310
Get the events for the specified project sorted from newest to oldest. This
endpoint can be accessed without authentication if the project is publicly
accessible.
D
Dmitriy Zaporozhets 已提交
311 312 313 314 315 316 317

```
GET /projects/:id/events
```

Parameters:

318 319
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
320
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
D
Dmitriy Zaporozhets 已提交
321 322

```json
J
Johannes Schleifenbaum 已提交
323 324 325 326 327 328 329 330 331
[
  {
    "title": null,
    "project_id": 15,
    "action_name": "closed",
    "target_id": 830,
    "target_type": "Issue",
    "author_id": 1,
    "data": null,
D
Dmitriy Zaporozhets 已提交
332 333 334 335 336 337 338
    "target_title": "Public project search field",
    "author": {
      "name": "Dmitriy Zaporozhets",
      "username": "root",
      "id": 1,
      "state": "active",
      "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
339
      "web_url": "http://localhost:3000/root"
D
Dmitriy Zaporozhets 已提交
340 341
    },
    "author_username": "root"
J
Johannes Schleifenbaum 已提交
342 343 344 345 346 347 348 349
  },
  {
    "title": null,
    "project_id": 15,
    "action_name": "opened",
    "target_id": null,
    "target_type": null,
    "author_id": 1,
D
Dmitriy Zaporozhets 已提交
350 351 352 353 354 355
    "author": {
      "name": "Dmitriy Zaporozhets",
      "username": "root",
      "id": 1,
      "state": "active",
      "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
356
      "web_url": "http://localhost:3000/root"
D
Dmitriy Zaporozhets 已提交
357
    },
358
    "author_username": "john",
J
Johannes Schleifenbaum 已提交
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383
    "data": {
      "before": "50d4420237a9de7be1304607147aec22e4a14af7",
      "after": "c5feabde2d8cd023215af4d2ceeb7a64839fc428",
      "ref": "refs/heads/master",
      "user_id": 1,
      "user_name": "Dmitriy Zaporozhets",
      "repository": {
        "name": "gitlabhq",
        "url": "git@dev.gitlab.org:gitlab/gitlabhq.git",
        "description": "GitLab: self hosted Git management software. \r\nDistributed under the MIT License.",
        "homepage": "https://dev.gitlab.org/gitlab/gitlabhq"
      },
      "commits": [
        {
          "id": "c5feabde2d8cd023215af4d2ceeb7a64839fc428",
          "message": "Add simple search to projects in public area",
          "timestamp": "2013-05-13T18:18:08+00:00",
          "url": "https://dev.gitlab.org/gitlab/gitlabhq/commit/c5feabde2d8cd023215af4d2ceeb7a64839fc428",
          "author": {
            "name": "Dmitriy Zaporozhets",
            "email": "dmitriy.zaporozhets@gmail.com"
          }
        }
      ],
      "total_commits_count": 1
D
Dmitriy Zaporozhets 已提交
384
    },
J
Johannes Schleifenbaum 已提交
385
    "target_title": null
D
Dmitriy Zaporozhets 已提交
386
  },
J
Johannes Schleifenbaum 已提交
387 388 389 390 391 392 393 394
  {
    "title": null,
    "project_id": 15,
    "action_name": "closed",
    "target_id": 840,
    "target_type": "Issue",
    "author_id": 1,
    "data": null,
D
Dmitriy Zaporozhets 已提交
395 396 397 398 399 400 401
    "target_title": "Finish & merge Code search PR",
    "author": {
      "name": "Dmitriy Zaporozhets",
      "username": "root",
      "id": 1,
      "state": "active",
      "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
402
      "web_url": "http://localhost:3000/root"
D
Dmitriy Zaporozhets 已提交
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425
    },
    "author_username": "root"
  },
  {
    "title": null,
    "project_id": 15,
    "action_name": "commented on",
    "target_id": 1312,
    "target_type": "Note",
    "author_id": 1,
    "data": null,
    "target_title": null,
    "created_at": "2015-12-04T10:33:58.089Z",
    "note": {
      "id": 1312,
      "body": "What an awesome day!",
      "attachment": null,
      "author": {
        "name": "Dmitriy Zaporozhets",
        "username": "root",
        "id": 1,
        "state": "active",
        "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
426
        "web_url": "http://localhost:3000/root"
D
Dmitriy Zaporozhets 已提交
427 428 429 430 431 432 433 434 435 436 437 438
      },
      "created_at": "2015-12-04T10:33:56.698Z",
      "system": false,
      "noteable_id": 377,
      "noteable_type": "Issue"
    },
    "author": {
      "name": "Dmitriy Zaporozhets",
      "username": "root",
      "id": 1,
      "state": "active",
      "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
439
      "web_url": "http://localhost:3000/root"
D
Dmitriy Zaporozhets 已提交
440 441
    },
    "author_username": "root"
J
Johannes Schleifenbaum 已提交
442 443
  }
]
D
Dmitriy Zaporozhets 已提交
444 445
```

446
### Create project
A
Alex Denisov 已提交
447

448
Creates a new project owned by the authenticated user.
A
Alex Denisov 已提交
449 450 451 452 453 454 455

```
POST /projects
```

Parameters:

456 457
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
458 459
| `name` | string | yes if path is not provided | The name of the new project. Equals path if not provided. |
| `path` | string | yes if name is not provided | Repository name for new project. Generated based on name if not provided (generated lowercased with dashes). |
460 461 462 463
| `namespace_id` | integer | no | Namespace for the new project (defaults to the current user's namespace) |
| `description` | string | no | Short project description |
| `issues_enabled` | boolean | no | Enable issues for this project |
| `merge_requests_enabled` | boolean | no | Enable merge requests for this project |
464
| `jobs_enabled` | boolean | no | Enable jobs for this project |
465 466 467 468
| `wiki_enabled` | boolean | no | Enable wiki for this project |
| `snippets_enabled` | boolean | no | Enable snippets for this project |
| `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
469
| `visibility` | String | no | See [project visibility level](#project-visibility-level) |
470
| `import_url` | string | no | URL to import repository from |
471 472
| `public_jobs` | boolean | no | If `true`, jobs can be viewed by non-project-members |
| `only_allow_merge_if_pipeline_succeeds` | boolean | no | Set whether merge requests can only be merged with successful jobs |
473
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
474 475
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
476

477 478
### Create project for user

479
Creates a new project owned by the specified user. Available only for admins.
480 481 482 483 484 485 486

```
POST /projects/user/:user_id
```

Parameters:

487 488 489 490 491
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `user_id` | integer | yes | The user ID of the project owner |
| `name` | string | yes | The name of the new project |
| `path` | string | no | Custom repository name for new project. By default generated based on name |
492
| `default_branch` | string | no | `master` by default |
493 494 495 496
| `namespace_id` | integer | no | Namespace for the new project (defaults to the current user's namespace) |
| `description` | string | no | Short project description |
| `issues_enabled` | boolean | no | Enable issues for this project |
| `merge_requests_enabled` | boolean | no | Enable merge requests for this project |
497
| `jobs_enabled` | boolean | no | Enable jobs for this project |
498 499 500 501
| `wiki_enabled` | boolean | no | Enable wiki for this project |
| `snippets_enabled` | boolean | no | Enable snippets for this project |
| `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
502
| `visibility` | string | no | See [project visibility level](#project-visibility-level) |
503
| `import_url` | string | no | URL to import repository from |
504 505
| `public_jobs` | boolean | no | If `true`, jobs can be viewed by non-project-members |
| `only_allow_merge_if_pipeline_succeeds` | boolean | no | Set whether merge requests can only be merged with successful jobs |
506
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
507 508
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
A
Alex Denisov 已提交
509

510 511
### Edit project

512
Updates an existing project.
513 514 515 516 517 518 519

```
PUT /projects/:id
```

Parameters:

520 521
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
522
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
523 524
| `name` | string | yes | The name of the project |
| `path` | string | no | Custom repository name for the project. By default generated based on name |
525
| `default_branch` | string | no | `master` by default |
526 527 528
| `description` | string | no | Short project description |
| `issues_enabled` | boolean | no | Enable issues for this project |
| `merge_requests_enabled` | boolean | no | Enable merge requests for this project |
529
| `jobs_enabled` | boolean | no | Enable jobs for this project |
530 531 532 533
| `wiki_enabled` | boolean | no | Enable wiki for this project |
| `snippets_enabled` | boolean | no | Enable snippets for this project |
| `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
534
| `visibility` | string | no | See [project visibility level](#project-visibility-level) |
535
| `import_url` | string | no | URL to import repository from |
536 537
| `public_jobs` | boolean | no | If `true`, jobs can be viewed by non-project-members |
| `only_allow_merge_if_pipeline_succeeds` | boolean | no | Set whether merge requests can only be merged with successful jobs |
538
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
539 540
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
541

542 543
### Fork project

544
Forks a project into the user namespace of the authenticated user or the one provided.
545 546

```
547
POST /projects/:id/fork
548 549 550 551
```

Parameters:

552 553
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
554
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
555
| `namespace` | integer/string | yes | The ID or path of the namespace that the project will be forked to |
556

557 558
### Star a project

559
Stars a given project. Returns status code `304` if the project is already starred.
560 561 562 563 564

```
POST /projects/:id/star
```

565 566
Parameters:

567 568
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
569
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
570 571

```bash
R
Robert Schilling 已提交
572
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/5/star"
573 574 575 576 577 578 579 580 581
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
582
  "visibility": "internal",
583 584 585 586 587 588 589 590 591 592 593 594 595 596
  "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git",
  "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
  "web_url": "http://example.com/diaspora/diaspora-project-site",
  "tag_list": [
    "example",
    "disapora project"
  ],
  "name": "Diaspora Project Site",
  "name_with_namespace": "Diaspora / Diaspora Project Site",
  "path": "diaspora-project-site",
  "path_with_namespace": "diaspora/diaspora-project-site",
  "issues_enabled": true,
  "open_issues_count": 1,
  "merge_requests_enabled": true,
597
  "jobs_enabled": true,
598 599
  "wiki_enabled": true,
  "snippets_enabled": false,
600
  "container_registry_enabled": false,
B
Ben Boeckel 已提交
601 602
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
603 604 605 606 607
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
608 609
    "kind": "group",
    "full_path": "diaspora"
610 611 612 613 614
  },
  "archived": true,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
  "shared_runners_enabled": true,
  "forks_count": 0,
615
  "star_count": 1,
616
  "public_jobs": true,
617
  "shared_with_groups": [],
J
James Lopez 已提交
618
  "only_allow_merge_if_pipeline_succeeds": false,
619
  "only_allow_merge_if_all_discussions_are_resolved": false,
620
  "request_access_enabled": false
621 622 623 624 625
}
```

### Unstar a project

626
Unstars a given project. Returns status code `304` if the project is not starred.
627 628

```
629
POST /projects/:id/unstar
630 631 632 633
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
634
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
635 636

```bash
R
Robert Schilling 已提交
637
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/5/unstar"
638 639 640 641 642 643 644 645 646
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
647
  "visibility": "internal",
648 649 650 651 652 653 654 655 656 657 658 659 660 661
  "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git",
  "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
  "web_url": "http://example.com/diaspora/diaspora-project-site",
  "tag_list": [
    "example",
    "disapora project"
  ],
  "name": "Diaspora Project Site",
  "name_with_namespace": "Diaspora / Diaspora Project Site",
  "path": "diaspora-project-site",
  "path_with_namespace": "diaspora/diaspora-project-site",
  "issues_enabled": true,
  "open_issues_count": 1,
  "merge_requests_enabled": true,
662
  "jobs_enabled": true,
663 664
  "wiki_enabled": true,
  "snippets_enabled": false,
665
  "container_registry_enabled": false,
B
Ben Boeckel 已提交
666 667
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
668 669 670 671 672
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
673 674
    "kind": "group",
    "full_path": "diaspora"
675 676 677 678 679
  },
  "archived": true,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
  "shared_runners_enabled": true,
  "forks_count": 0,
680
  "star_count": 0,
681
  "public_jobs": true,
682
  "shared_with_groups": [],
J
James Lopez 已提交
683
  "only_allow_merge_if_pipeline_succeeds": false,
684
  "only_allow_merge_if_all_discussions_are_resolved": false,
685
  "request_access_enabled": false
686 687 688
}
```

689 690
### Archive a project

691
Archives the project if the user is either admin or the project owner of this project. This action is
692 693 694
idempotent, thus archiving an already archived project will not change the project.

```
695
POST /projects/:id/archive
696 697 698 699
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
700
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
701 702

```bash
R
Robert Schilling 已提交
703
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/5/archive"
704 705 706 707 708 709 710 711 712
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
713
  "visibility": "private",
714 715 716 717 718 719 720 721 722 723
  "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git",
  "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
  "web_url": "http://example.com/diaspora/diaspora-project-site",
  "tag_list": [
    "example",
    "disapora project"
  ],
  "owner": {
    "id": 3,
    "name": "Diaspora",
B
Ben Boeckel 已提交
724
    "created_at": "2013-09-30T13:46:02Z"
725 726 727 728 729 730 731 732
  },
  "name": "Diaspora Project Site",
  "name_with_namespace": "Diaspora / Diaspora Project Site",
  "path": "diaspora-project-site",
  "path_with_namespace": "diaspora/diaspora-project-site",
  "issues_enabled": true,
  "open_issues_count": 1,
  "merge_requests_enabled": true,
733
  "jobs_enabled": true,
734 735
  "wiki_enabled": true,
  "snippets_enabled": false,
736
  "container_registry_enabled": false,
B
Ben Boeckel 已提交
737 738
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
739 740 741 742 743
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
744 745
    "kind": "group",
    "full_path": "diaspora"
746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761
  },
  "permissions": {
    "project_access": {
      "access_level": 10,
      "notification_level": 3
    },
    "group_access": {
      "access_level": 50,
      "notification_level": 3
    }
  },
  "archived": true,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
  "shared_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
762
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
763
  "public_jobs": true,
764
  "shared_with_groups": [],
J
James Lopez 已提交
765
  "only_allow_merge_if_pipeline_succeeds": false,
766
  "only_allow_merge_if_all_discussions_are_resolved": false,
767
  "request_access_enabled": false
768 769 770 771 772
}
```

### Unarchive a project

773
Unarchives the project if the user is either admin or the project owner of this project. This action is
774 775 776
idempotent, thus unarchiving an non-archived project will not change the project.

```
S
Sergey Gnuskov 已提交
777
POST /projects/:id/unarchive
778 779 780 781
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
782
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
783 784

```bash
R
Robert Schilling 已提交
785
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/5/unarchive"
786 787 788 789 790 791 792 793 794
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
795
  "visibility": "private",
796 797 798 799 800 801 802 803 804 805
  "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git",
  "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
  "web_url": "http://example.com/diaspora/diaspora-project-site",
  "tag_list": [
    "example",
    "disapora project"
  ],
  "owner": {
    "id": 3,
    "name": "Diaspora",
B
Ben Boeckel 已提交
806
    "created_at": "2013-09-30T13:46:02Z"
807 808 809 810 811 812 813 814
  },
  "name": "Diaspora Project Site",
  "name_with_namespace": "Diaspora / Diaspora Project Site",
  "path": "diaspora-project-site",
  "path_with_namespace": "diaspora/diaspora-project-site",
  "issues_enabled": true,
  "open_issues_count": 1,
  "merge_requests_enabled": true,
815
  "jobs_enabled": true,
816 817
  "wiki_enabled": true,
  "snippets_enabled": false,
818
  "container_registry_enabled": false,
B
Ben Boeckel 已提交
819 820
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
821 822 823 824 825
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
826 827
    "kind": "group",
    "full_path": "diaspora"
828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843
  },
  "permissions": {
    "project_access": {
      "access_level": 10,
      "notification_level": 3
    },
    "group_access": {
      "access_level": 50,
      "notification_level": 3
    }
  },
  "archived": false,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
  "shared_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
844
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
845
  "public_jobs": true,
846
  "shared_with_groups": [],
J
James Lopez 已提交
847
  "only_allow_merge_if_pipeline_succeeds": false,
848
  "only_allow_merge_if_all_discussions_are_resolved": false,
849
  "request_access_enabled": false
850 851 852
}
```

853
### Remove project
D
Dmitriy Zaporozhets 已提交
854

855
Removes a project including all associated resources (issues, merge requests etc.)
D
Dmitriy Zaporozhets 已提交
856 857 858 859 860 861 862

```
DELETE /projects/:id
```

Parameters:

863 864
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
865
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
866

D
Douwe Maan 已提交
867 868 869 870 871 872 873 874 875 876 877 878
## Uploads

### Upload a file

Uploads a file to the specified project to be used in an issue or merge request description, or a comment.

```
POST /projects/:id/uploads
```

Parameters:

879 880
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
881
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
882
| `file` | string | yes | The file to be uploaded |
D
Douwe Maan 已提交
883

884 885 886 887 888 889 890 891 892 893 894
To upload a file from your filesystem, use the `--form` argument. This causes
cURL to post data using the header `Content-Type: multipart/form-data`.
The `file=` parameter must point to a file on your filesystem and be preceded
by `@`. For example:

```bash
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" --form "file=@dk.png" https://gitlab.example.com/api/v3/projects/5/uploads
```

Returned object:

D
Douwe Maan 已提交
895 896 897 898 899 900 901 902 903
```json
{
  "alt": "dk",
  "url": "/uploads/66dbcd21ec5d24ed6ea225176098d52b/dk.png",
  "markdown": "![dk](/uploads/66dbcd21ec5d24ed6ea225176098d52b/dk.png)"
}
```

**Note**: The returned `url` is relative to the project path.
904 905
In Markdown contexts, the link is automatically expanded when the format in
`markdown` is used.
D
Douwe Maan 已提交
906

907
## Project members
908

909
Please consult the [Project Members](members.md) documentation.
N
Nihad Abbasov 已提交
910

911 912 913 914 915 916 917 918 919 920
### Share project with group

Allow to share project with group.

```
POST /projects/:id/share
```

Parameters:

921 922
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
923
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
924 925 926
| `group_id` | integer | yes | The ID of the group to share with |
| `group_access` | integer | yes | The permissions level to grant the group |
| `expires_at` | string | no | Share expiration date in ISO 8601 format: 2016-09-26 |
927

928 929 930 931 932 933 934 935 936 937 938 939
### Delete a shared project link within a group

Unshare the project from the group. Returns `204` and no content on success.

```
DELETE /projects/:id/share/:group_id
```

Parameters:

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
940
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
941 942 943
| `group_id` | integer | yes | The ID of the group |

```bash
R
Robert Schilling 已提交
944
curl --request DELETE --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/5/share/17
945 946
```

947 948
## Hooks

949 950 951
Also called Project Hooks and Webhooks.
These are different for [System Hooks](system_hooks.md) that are system wide.

952 953
### List project hooks

954
Get a list of project hooks.
M
miks 已提交
955 956 957 958 959 960 961

```
GET /projects/:id/hooks
```

Parameters:

962 963
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
964
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
M
miks 已提交
965

966
### Get project hook
967

968
Get a specific hook for a project.
969 970 971 972 973

```
GET /projects/:id/hooks/:hook_id
```

974
Parameters:
975

976 977
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
978
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
979
| `hook_id` | integer | yes | The ID of a project hook |
980

981 982 983 984
```json
{
  "id": 1,
  "url": "http://example.com/hook",
985
  "project_id": 3,
B
Ben Boeckel 已提交
986 987 988
  "push_events": true,
  "issues_events": true,
  "merge_requests_events": true,
989
  "tag_push_events": true,
B
Ben Boeckel 已提交
990
  "note_events": true,
991
  "job_events": true,
992
  "pipeline_events": true,
993
  "wiki_page_events": true,
B
Ben Boeckel 已提交
994
  "enable_ssl_verification": true,
995 996 997 998 999 1000
  "created_at": "2012-10-12T17:04:47Z"
}
```

### Add project hook

1001
Adds a hook to a specified project.
M
miks 已提交
1002 1003 1004 1005 1006 1007 1008

```
POST /projects/:id/hooks
```

Parameters:

1009 1010
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1011
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1012 1013 1014 1015 1016 1017
| `url` | string | yes | The hook URL |
| `push_events` | boolean | no | Trigger hook on push events |
| `issues_events` | boolean | no | Trigger hook on issues events |
| `merge_requests_events` | boolean | no | Trigger hook on merge requests events |
| `tag_push_events` | boolean | no | Trigger hook on tag push events |
| `note_events` | boolean | no | Trigger hook on note events |
1018
| `job_events` | boolean | no | Trigger hook on job events |
1019 1020 1021
| `pipeline_events` | boolean | no | Trigger hook on pipeline events |
| `wiki_events` | boolean | no | Trigger hook on wiki events |
| `enable_ssl_verification` | boolean | no | Do SSL verification when triggering the hook |
1022
| `token` | string | no | Secret token to validate received payloads; this will not be returned in the response |
1023

1024 1025
### Edit project hook

1026
Edits a hook for a specified project.
1027 1028 1029 1030 1031 1032 1033

```
PUT /projects/:id/hooks/:hook_id
```

Parameters:

1034 1035
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1036
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1037 1038 1039 1040 1041 1042 1043
| `hook_id` | integer | yes | The ID of the project hook |
| `url` | string | yes | The hook URL |
| `push_events` | boolean | no | Trigger hook on push events |
| `issues_events` | boolean | no | Trigger hook on issues events |
| `merge_requests_events` | boolean | no | Trigger hook on merge requests events |
| `tag_push_events` | boolean | no | Trigger hook on tag push events |
| `note_events` | boolean | no | Trigger hook on note events |
1044
| `job_events` | boolean | no | Trigger hook on job events |
1045 1046 1047
| `pipeline_events` | boolean | no | Trigger hook on pipeline events |
| `wiki_events` | boolean | no | Trigger hook on wiki events |
| `enable_ssl_verification` | boolean | no | Do SSL verification when triggering the hook |
1048
| `token` | string | no | Secret token to validate received payloads; this will not be returned in the response |
1049

1050
### Delete project hook
M
miks 已提交
1051

1052
Removes a hook from a project. This is an idempotent method and can be called multiple times.
1053
Either the hook is available or not.
M
miks 已提交
1054 1055

```
1056
DELETE /projects/:id/hooks/:hook_id
M
miks 已提交
1057 1058 1059 1060
```

Parameters:

1061 1062
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1063
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1064
| `hook_id` | integer | yes | The ID of the project hook |
M
miks 已提交
1065

1066 1067
Note the JSON response differs if the hook is available or not. If the project hook
is available before it is returned in the JSON response or an empty response is returned.
1068 1069 1070

## Branches

M
Miroslav Meca 已提交
1071 1072
For more information please consult the [Branches](branches.md) documentation.

1073 1074 1075 1076 1077 1078 1079 1080 1081 1082
### List branches

Lists all branches of a project.

```
GET /projects/:id/repository/branches
```

Parameters:

1083 1084
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1085
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1086

M
Marin Jankovski 已提交
1087 1088 1089
```json
[
  {
J
Johannes Schleifenbaum 已提交
1090
    "name": "async",
M
Marin Jankovski 已提交
1091
    "commit": {
J
Johannes Schleifenbaum 已提交
1092
      "id": "a2b702edecdf41f07b42653eb1abe30ce98b9fca",
M
Miroslav Meca 已提交
1093 1094
      "parent_ids": [
        "3f94fc7c85061973edc9906ae170cc269b07ca55"
J
Johannes Schleifenbaum 已提交
1095
      ],
1096
      "message": "give Caolan credit where it's due (up top)",
M
Miroslav Meca 已提交
1097 1098
      "author_name": "Jeremy Ashkenas",
      "author_email": "jashkenas@example.com",
J
Johannes Schleifenbaum 已提交
1099
      "authored_date": "2010-12-08T21:28:50+00:00",
M
Miroslav Meca 已提交
1100 1101
      "committer_name": "Jeremy Ashkenas",
      "committer_email": "jashkenas@example.com",
J
Johannes Schleifenbaum 已提交
1102
      "committed_date": "2010-12-08T21:28:50+00:00"
M
Marin Jankovski 已提交
1103
    },
M
Miroslav Meca 已提交
1104 1105 1106
    "protected": false,
    "developers_can_push": false,
    "developers_can_merge": false
M
Marin Jankovski 已提交
1107 1108 1109 1110 1111
  },
  {
    "name": "gh-pages",
    "commit": {
      "id": "101c10a60019fe870d21868835f65c25d64968fc",
M
Miroslav Meca 已提交
1112 1113
      "parent_ids": [
          "9c15d2e26945a665131af5d7b6d30a06ba338aaa"
J
Johannes Schleifenbaum 已提交
1114
      ],
M
Marin Jankovski 已提交
1115
      "message": "Underscore.js 1.5.2",
M
Miroslav Meca 已提交
1116 1117
      "author_name": "Jeremy Ashkenas",
      "author_email": "jashkenas@example.com",
B
Ben Boeckel 已提交
1118
      "authored_date": "2013-09-07T12:58:21+00:00",
M
Miroslav Meca 已提交
1119 1120
      "committer_name": "Jeremy Ashkenas",
      "committer_email": "jashkenas@example.com",
B
Ben Boeckel 已提交
1121
      "committed_date": "2013-09-07T12:58:21+00:00"
M
Marin Jankovski 已提交
1122
    },
M
Miroslav Meca 已提交
1123 1124 1125
    "protected": false,
    "developers_can_push": false,
    "developers_can_merge": false
M
Marin Jankovski 已提交
1126 1127 1128
  }
]
```
1129

M
Miroslav Meca 已提交
1130
### Single branch
1131

M
Miroslav Meca 已提交
1132
A specific branch of a project.
1133 1134 1135 1136 1137 1138 1139

```
GET /projects/:id/repository/branches/:branch
```

Parameters:

1140 1141
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1142
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1143 1144 1145
| `branch` | string | yes | The name of the branch |
| `developers_can_push` | boolean | no | Flag if developers can push to the branch |
| `developers_can_merge` | boolean | no | Flag if developers can merge to the branch |
1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156

### Protect single branch

Protects a single branch of a project.

```
PUT /projects/:id/repository/branches/:branch/protect
```

Parameters:

1157 1158
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1159
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1160
| `branch` | string | yes | The name of the branch |
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171

### Unprotect single branch

Unprotects a single branch of a project.

```
PUT /projects/:id/repository/branches/:branch/unprotect
```

Parameters:

1172 1173
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1174
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1175
| `branch` | string | yes | The name of the branch |
1176 1177 1178

## Admin fork relation

1179
Allows modification of the forked relationship between existing projects. Available only for admins.
1180 1181 1182 1183 1184 1185 1186 1187 1188

### Create a forked from/to relation between existing projects.

```
POST /projects/:id/fork/:forked_from_id
```

Parameters:

1189 1190
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1191
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1192
| `forked_from_id` | ID | yes | The ID of the project that was forked from |
1193 1194 1195 1196 1197 1198 1199 1200 1201

### Delete an existing forked from relationship

```
DELETE /projects/:id/fork
```

Parameter:

1202 1203
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1204
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
I
Izaak Alpert 已提交
1205 1206 1207

## Search for projects by name

1208 1209 1210
Search for projects by name which are accessible to the authenticated user. This
endpoint can be accessed without authentication if the project is publicly
accessible.
I
Izaak Alpert 已提交
1211 1212 1213 1214 1215 1216 1217

```
GET /projects/search/:query
```

Parameters:

1218 1219
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1220 1221
| `query` | string | yes | A string contained in the project name |
| `order_by` | string | no | Return requests ordered by `id`, `name`, `created_at` or `last_activity_at` fields |
1222
| `sort` | string | no | Return requests sorted in `asc` or `desc` order |
1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236

## Start the Housekeeping task for a Project

>**Note:** This feature was introduced in GitLab 9.0

```
POST /projects/:id/housekeeping
```

Parameters:

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id` | integer/string | yes | The ID of the project or NAMESPACE/PROJECT_NAME |