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

3
## Project visibility level
4

5 6
Project in GitLab can be either private, internal or public.
This is determined by the `visibility` field in the project.
7

8
Values for the project visibility level are:
9

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 20 21 22
## Project merge method

There are currently three options for `merge_method` to choose from:

23
- `merge`:
24 25
  A merge commit is created for every merge, and merging is allowed as long as there are no conflicts.

26
- `rebase_merge`:
27 28 29
  A merge commit is created for every merge, but merging is only allowed if fast-forward merge is possible.
  This way you could make sure that if this merge request would build, after merging to target branch it would also build.

30
- `ff`:
31 32
  No merge commits are created and all merges are fast-forwarded, which means that merging is only allowed if the branch could be fast-forwarded.

33
## List all projects
34

35
Get a list of all visible projects across GitLab for the authenticated user.
36
When accessed without authentication, only public projects with "simple" fields are returned.
37 38 39 40 41

```
GET /projects
```

42 43 44 45 46 47
| 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` |
48
| `search` | string | no | Return list of projects matching the search criteria |
49
| `simple` | boolean | no | Return only limited fields for each project. This is a no-op without authentication as then _only_ simple fields are returned. |
50
| `owned` | boolean | no | Limit by projects explicitly owned by the current user |
51
| `membership` | boolean | no | Limit by projects that the current user is a member of |
52
| `starred` | boolean | no | Limit by projects starred by the current user |
53
| `statistics` | boolean | no | Include project statistics |
54
| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) |
55 56
| `with_issues_enabled` | boolean | no | Limit by enabled issues feature |
| `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature |
57
| `with_programming_language` | string | no | Limit by projects which use the given programming language |
58 59
| `wiki_checksum_failed` | boolean | no | Limit projects where the wiki checksum calculation has failed _([Introduced][ee-6137] in [GitLab Premium][eep] 11.2)_ |
| `repository_checksum_failed` | boolean | no | Limit projects where the repository checksum calculation has failed _([Introduced][ee-6137] in [GitLab Premium][eep] 11.2)_ |
60
| `min_access_level` | integer | no | Limit by current user minimal [access level](members.md) |
vanadium23's avatar
vanadium23 committed
61

62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
When `simple=true` or the user is unauthenticated this returns something like:

```json
[
  {
    "id": 4,
    "description": null,
    "default_branch": "master",
    "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",
    "readme_url": "http://example.com/diaspora/diaspora-client/blob/master/README.md",
    "tag_list": [
      "example",
      "disapora client"
    ],
    "name": "Diaspora Client",
    "name_with_namespace": "Diaspora / Diaspora Client",
    "path": "diaspora-client",
    "path_with_namespace": "diaspora/diaspora-client",
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
    "forks_count": 0,
    "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png",
    "star_count": 0,
  },
  {
    "id": 6,
    "description": null,
    "default_branch": "master",
...
```

When the user is authenticated and `simple` is not set this returns something like:

vanadium23's avatar
vanadium23 committed
97 98 99 100 101 102 103 104 105 106
```json
[
  {
    "id": 4,
    "description": null,
    "default_branch": "master",
    "visibility": "private",
    "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",
107
    "readme_url": "http://example.com/diaspora/diaspora-client/blob/master/README.md",
vanadium23's avatar
vanadium23 committed
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
    "tag_list": [
      "example",
      "disapora client"
    ],
    "owner": {
      "id": 3,
      "name": "Diaspora",
      "created_at": "2013-09-30T13:46:02Z"
    },
    "name": "Diaspora Client",
    "name_with_namespace": "Diaspora / Diaspora Client",
    "path": "diaspora-client",
    "path_with_namespace": "diaspora/diaspora-client",
    "issues_enabled": true,
    "open_issues_count": 1,
    "merge_requests_enabled": true,
    "jobs_enabled": true,
    "wiki_enabled": true,
    "snippets_enabled": false,
127
    "resolve_outdated_diff_discussions": false,
vanadium23's avatar
vanadium23 committed
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
    "container_registry_enabled": false,
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
    "creator_id": 3,
    "namespace": {
      "id": 3,
      "name": "Diaspora",
      "path": "diaspora",
      "kind": "group",
      "full_path": "diaspora"
    },
    "import_status": "none",
    "archived": false,
    "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png",
    "shared_runners_enabled": true,
    "forks_count": 0,
    "star_count": 0,
    "runners_token": "b8547b1dc37721d05889db52fa2f02",
    "public_jobs": true,
    "shared_with_groups": [],
    "only_allow_merge_if_pipeline_succeeds": false,
    "only_allow_merge_if_all_discussions_are_resolved": false,
    "request_access_enabled": false,
151
    "merge_method": "merge",
vanadium23's avatar
vanadium23 committed
152 153 154 155 156 157
    "statistics": {
      "commit_count": 37,
      "storage_size": 1038090,
      "repository_size": 1038090,
      "lfs_objects_size": 0,
      "job_artifacts_size": 0
158 159 160 161 162 163 164 165 166 167
    },
    "_links": {
      "self": "http://example.com/api/v4/projects",
      "issues": "http://example.com/api/v4/projects/1/issues",
      "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
      "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
      "labels": "http://example.com/api/v4/projects/1/labels",
      "events": "http://example.com/api/v4/projects/1/events",
      "members": "http://example.com/api/v4/projects/1/members"
    },
vanadium23's avatar
vanadium23 committed
168 169 170 171 172 173 174 175 176
  },
  {
    "id": 6,
    "description": null,
    "default_branch": "master",
    "visibility": "private",
    "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",
177
    "readme_url": "http://example.com/brightbox/puppet/blob/master/README.md",
vanadium23's avatar
vanadium23 committed
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
    "tag_list": [
      "example",
      "puppet"
    ],
    "owner": {
      "id": 4,
      "name": "Brightbox",
      "created_at": "2013-09-30T13:46:02Z"
    },
    "name": "Puppet",
    "name_with_namespace": "Brightbox / Puppet",
    "path": "puppet",
    "path_with_namespace": "brightbox/puppet",
    "issues_enabled": true,
    "open_issues_count": 1,
    "merge_requests_enabled": true,
    "jobs_enabled": true,
    "wiki_enabled": true,
    "snippets_enabled": false,
197
    "resolve_outdated_diff_discussions": false,
vanadium23's avatar
vanadium23 committed
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
    "container_registry_enabled": false,
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
    "creator_id": 3,
    "namespace": {
      "id": 4,
      "name": "Brightbox",
      "path": "brightbox",
      "kind": "group",
      "full_path": "brightbox"
    },
    "import_status": "none",
    "import_error": null,
    "permissions": {
      "project_access": {
        "access_level": 10,
        "notification_level": 3
      },
      "group_access": {
        "access_level": 50,
        "notification_level": 3
      }
    },
    "archived": false,
    "avatar_url": null,
    "shared_runners_enabled": true,
    "forks_count": 0,
    "star_count": 0,
    "runners_token": "b8547b1dc37721d05889db52fa2f02",
    "public_jobs": true,
    "shared_with_groups": [],
    "only_allow_merge_if_pipeline_succeeds": false,
    "only_allow_merge_if_all_discussions_are_resolved": false,
    "request_access_enabled": false,
232
    "merge_method": "merge",
vanadium23's avatar
vanadium23 committed
233 234 235 236 237 238
    "statistics": {
      "commit_count": 12,
      "storage_size": 2066080,
      "repository_size": 2066080,
      "lfs_objects_size": 0,
      "job_artifacts_size": 0
239 240 241 242 243 244 245 246 247
    },
    "_links": {
      "self": "http://example.com/api/v4/projects",
      "issues": "http://example.com/api/v4/projects/1/issues",
      "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
      "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
      "labels": "http://example.com/api/v4/projects/1/labels",
      "events": "http://example.com/api/v4/projects/1/events",
      "members": "http://example.com/api/v4/projects/1/members"
vanadium23's avatar
vanadium23 committed
248 249 250 251 252
    }
  }
]
```

253 254 255 256 257 258
You can filter by [custom attributes](custom_attributes.md) with:

```
GET /projects?custom_attributes[key]=value&custom_attributes[other_key]=other_value
```

259
## List user projects
vanadium23's avatar
vanadium23 committed
260

Davin Walker's avatar
Davin Walker committed
261
Get a list of visible projects owned by the given user. When accessed without authentication, only public projects are returned.
vanadium23's avatar
vanadium23 committed
262 263 264 265 266 267 268 269 270 271 272 273 274

```
GET /users/:user_id/projects
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `user_id` | string | yes | The ID or username of the user |
| `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` |
| `search` | string | no | Return list of projects matching the search criteria |
275
| `simple` | boolean | no | Return only limited fields for each project. This is a no-op without authentication as then _only_ simple fields are returned. |
276
| `owned` | boolean | no | Limit by projects explicitly owned by the current user |
vanadium23's avatar
vanadium23 committed
277 278 279
| `membership` | boolean | no | Limit by projects that the current user is a member of |
| `starred` | boolean | no | Limit by projects starred by the current user |
| `statistics` | boolean | no | Include project statistics |
280
| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) |
281 282
| `with_issues_enabled` | boolean | no | Limit by enabled issues feature |
| `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature |
283
| `with_programming_language` | string | no | Limit by projects which use the given programming language |
284
| `min_access_level` | integer | no | Limit by current user minimal [access level](members.md) |
285

286 287 288
```json
[
  {
289
    "id": 4,
290 291
    "description": null,
    "default_branch": "master",
292
    "visibility": "private",
293 294 295
    "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",
296
    "readme_url": "http://example.com/diaspora/diaspora-client/blob/master/README.md",
297 298 299 300
    "tag_list": [
      "example",
      "disapora client"
    ],
301
    "owner": {
302 303
      "id": 3,
      "name": "Diaspora",
Ben Boeckel's avatar
Ben Boeckel committed
304
      "created_at": "2013-09-30T13:46:02Z"
305
    },
306 307 308 309 310
    "name": "Diaspora Client",
    "name_with_namespace": "Diaspora / Diaspora Client",
    "path": "diaspora-client",
    "path_with_namespace": "diaspora/diaspora-client",
    "issues_enabled": true,
311
    "open_issues_count": 1,
312
    "merge_requests_enabled": true,
313
    "jobs_enabled": true,
314
    "wiki_enabled": true,
315
    "snippets_enabled": false,
316
    "resolve_outdated_diff_discussions": false,
317
    "container_registry_enabled": false,
Ben Boeckel's avatar
Ben Boeckel committed
318 319
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
320
    "creator_id": 3,
321 322 323 324
    "namespace": {
      "id": 3,
      "name": "Diaspora",
      "path": "diaspora",
325 326
      "kind": "group",
      "full_path": "diaspora"
327
    },
328
    "import_status": "none",
329
    "archived": false,
Tomasz Maczukin's avatar
Tomasz Maczukin committed
330 331 332
    "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png",
    "shared_runners_enabled": true,
    "forks_count": 0,
333 334
    "star_count": 0,
    "runners_token": "b8547b1dc37721d05889db52fa2f02",
335
    "public_jobs": true,
336
    "shared_with_groups": [],
337
    "only_allow_merge_if_pipeline_succeeds": false,
338
    "only_allow_merge_if_all_discussions_are_resolved": false,
339
    "request_access_enabled": false,
340
    "merge_method": "merge",
341 342 343 344 345 346
    "statistics": {
      "commit_count": 37,
      "storage_size": 1038090,
      "repository_size": 1038090,
      "lfs_objects_size": 0,
      "job_artifacts_size": 0
347 348 349 350 351 352 353 354 355
    },
    "_links": {
      "self": "http://example.com/api/v4/projects",
      "issues": "http://example.com/api/v4/projects/1/issues",
      "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
      "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
      "labels": "http://example.com/api/v4/projects/1/labels",
      "events": "http://example.com/api/v4/projects/1/events",
      "members": "http://example.com/api/v4/projects/1/members"
356
    }
357 358
  },
  {
359
    "id": 6,
360
    "description": null,
361
    "default_branch": "master",
362
    "visibility": "private",
363 364 365
    "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",
366
    "readme_url": "http://example.com/brightbox/puppet/blob/master/README.md",
367 368 369 370
    "tag_list": [
      "example",
      "puppet"
    ],
371
    "owner": {
372 373 374
      "id": 4,
      "name": "Brightbox",
      "created_at": "2013-09-30T13:46:02Z"
375
    },
376 377 378 379
    "name": "Puppet",
    "name_with_namespace": "Brightbox / Puppet",
    "path": "puppet",
    "path_with_namespace": "brightbox/puppet",
380
    "issues_enabled": true,
381
    "open_issues_count": 1,
382
    "merge_requests_enabled": true,
383
    "jobs_enabled": true,
384
    "wiki_enabled": true,
385
    "snippets_enabled": false,
386
    "resolve_outdated_diff_discussions": false,
387
    "container_registry_enabled": false,
388 389
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
390
    "creator_id": 3,
391
    "namespace": {
392 393 394
      "id": 4,
      "name": "Brightbox",
      "path": "brightbox",
395 396
      "kind": "group",
      "full_path": "brightbox"
397
    },
398 399
    "import_status": "none",
    "import_error": null,
400 401 402 403 404 405 406 407 408 409
    "permissions": {
      "project_access": {
        "access_level": 10,
        "notification_level": 3
      },
      "group_access": {
        "access_level": 50,
        "notification_level": 3
      }
    },
410
    "archived": false,
Tomasz Maczukin's avatar
Tomasz Maczukin committed
411 412 413 414
    "avatar_url": null,
    "shared_runners_enabled": true,
    "forks_count": 0,
    "star_count": 0,
415
    "runners_token": "b8547b1dc37721d05889db52fa2f02",
416
    "public_jobs": true,
417
    "shared_with_groups": [],
418
    "only_allow_merge_if_pipeline_succeeds": false,
419
    "only_allow_merge_if_all_discussions_are_resolved": false,
420
    "request_access_enabled": false,
421
    "merge_method": "merge",
422 423 424 425 426 427
    "statistics": {
      "commit_count": 12,
      "storage_size": 2066080,
      "repository_size": 2066080,
      "lfs_objects_size": 0,
      "job_artifacts_size": 0
428 429 430 431 432 433 434 435 436
    },
    "_links": {
      "self": "http://example.com/api/v4/projects",
      "issues": "http://example.com/api/v4/projects/1/issues",
      "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
      "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
      "labels": "http://example.com/api/v4/projects/1/labels",
      "events": "http://example.com/api/v4/projects/1/events",
      "members": "http://example.com/api/v4/projects/1/members"
437
    }
438 439 440 441
  }
]
```

442
## Get single project
443

444 445
Get a specific project. This endpoint can be accessed without authentication if
the project is publicly accessible.
446 447 448 449 450

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

451 452
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
453
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
454
| `statistics` | boolean | no | Include project statistics |
455
| `license` | boolean | no | Include project license data |
456
| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) |
457

458 459
```json
{
460
  "id": 3,
461
  "description": null,
462
  "default_branch": "master",
463
  "visibility": "private",
464 465 466
  "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",
467
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
468 469 470 471
  "tag_list": [
    "example",
    "disapora project"
  ],
472
  "owner": {
473 474
    "id": 3,
    "name": "Diaspora",
Ben Boeckel's avatar
Ben Boeckel committed
475
    "created_at": "2013-09-30T13:46:02Z"
476
  },
477 478 479 480
  "name": "Diaspora Project Site",
  "name_with_namespace": "Diaspora / Diaspora Project Site",
  "path": "diaspora-project-site",
  "path_with_namespace": "diaspora/diaspora-project-site",
481
  "issues_enabled": true,
482
  "open_issues_count": 1,
483
  "merge_requests_enabled": true,
484
  "jobs_enabled": true,
485
  "wiki_enabled": true,
486
  "snippets_enabled": false,
487
  "resolve_outdated_diff_discussions": false,
488
  "container_registry_enabled": false,
Ben Boeckel's avatar
Ben Boeckel committed
489 490
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
491
  "creator_id": 3,
492 493 494 495
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
496 497
    "kind": "group",
    "full_path": "diaspora"
498
  },
499 500
  "import_status": "none",
  "import_error": null,
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
501 502 503 504 505 506 507 508 509
  "permissions": {
    "project_access": {
      "access_level": 10,
      "notification_level": 3
    },
    "group_access": {
      "access_level": 50,
      "notification_level": 3
    }
510
  },
511
  "archived": false,
Tomasz Maczukin's avatar
Tomasz Maczukin committed
512
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
513 514 515 516 517 518 519 520
  "license_url": "http://example.com/diaspora/diaspora-client/blob/master/LICENSE",
  "license": {
    "key": "lgpl-3.0",
    "name": "GNU Lesser General Public License v3.0",
    "nickname": "GNU LGPLv3",
    "html_url": "http://choosealicense.com/licenses/lgpl-3.0/",
    "source_url": "http://www.gnu.org/licenses/lgpl-3.0.txt"
  },
Tomasz Maczukin's avatar
Tomasz Maczukin committed
521 522 523
  "shared_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
524
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
525
  "public_jobs": true,
526 527 528 529
  "shared_with_groups": [
    {
      "group_id": 4,
      "group_name": "Twitter",
530
      "group_full_path": "twitter",
531 532 533 534 535
      "group_access_level": 30
    },
    {
      "group_id": 3,
      "group_name": "Gitlab Org",
536
      "group_full_path": "gitlab-org",
537 538
      "group_access_level": 10
    }
539
  ],
540
  "only_allow_merge_if_pipeline_succeeds": false,
541
  "only_allow_merge_if_all_discussions_are_resolved": false,
542
  "printing_merge_requests_link_enabled": true,
543
  "request_access_enabled": false,
544
  "merge_method": "merge",
545 546 547 548 549 550
  "statistics": {
    "commit_count": 37,
    "storage_size": 1038090,
    "repository_size": 1038090,
    "lfs_objects_size": 0,
    "job_artifacts_size": 0
551 552 553 554 555 556 557 558 559
  },
  "_links": {
    "self": "http://example.com/api/v4/projects",
    "issues": "http://example.com/api/v4/projects/1/issues",
    "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
    "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
    "labels": "http://example.com/api/v4/projects/1/labels",
    "events": "http://example.com/api/v4/projects/1/events",
    "members": "http://example.com/api/v4/projects/1/members"
560
  }
561 562 563
}
```

564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586
If the project is a fork, and you provide a valid token to authenticate, the
`forked_from_project` field will appear in the response.

```json
{
   "id":3,

   ...

   "forked_from_project":{
      "id":13083,
      "description":"GitLab Community Edition",
      "name":"GitLab Community Edition",
      "name_with_namespace":"GitLab.org / GitLab Community Edition",
      "path":"gitlab-ce",
      "path_with_namespace":"gitlab-org/gitlab-ce",
      "created_at":"2013-09-26T06:02:36.000Z",
      "default_branch":"master",
      "tag_list":[],
      "ssh_url_to_repo":"git@gitlab.com:gitlab-org/gitlab-ce.git",
      "http_url_to_repo":"https://gitlab.com/gitlab-org/gitlab-ce.git",
      "web_url":"https://gitlab.com/gitlab-org/gitlab-ce",
      "avatar_url":"https://assets.gitlab-static.net/uploads/-/system/project/avatar/13083/logo-extra-whitespace.png",
587 588 589 590 591 592 593 594
      "license_url": "https://gitlab.com/gitlab-org/gitlab-ce/blob/master/LICENSE",
      "license": {
        "key": "mit",
        "name": "MIT License",
        "nickname": null,
        "html_url": "http://choosealicense.com/licenses/mit/",
        "source_url": "https://opensource.org/licenses/MIT",
      },
595 596
      "star_count":3812,
      "forks_count":3561,
597 598 599 600 601 602 603 604 605
      "last_activity_at":"2018-01-02T11:40:26.570Z",
      "namespace": {
            "id": 72,
            "name": "GitLab.org",
            "path": "gitlab-org",
            "kind": "group",
            "full_path": "gitlab-org",
            "parent_id": null
      }
606 607 608 609 610 611 612
   }

   ...

}
```

613
## Get project users
614

615
Get the users list of a project.
616

617 618 619
```
GET /projects/:id/users
```
620

621 622
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
623 624
| `search` | string | no | Search for specific users |

625
```json
626 627
[
  {
628 629 630 631 632 633
    "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"
634
  },
635
  {
636 637 638 639 640 641
    "id": 2,
    "username": "jack_smith",
    "name": "Jack Smith",
    "state": "blocked",
    "avatar_url": "http://gravatar.com/../e32131cd8.jpeg",
    "web_url": "http://localhost:3000/jack_smith"
642 643
  }
]
644 645
```

646
## Get project events
647

648
Please refer to the [Events API documentation](events.md#list-a-projects-visible-events).
649

650
## Create project
651

652
Creates a new project owned by the authenticated user.
653 654 655 656 657

```
POST /projects
```

658 659
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
660 661
| `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). |
662 663 664 665
| `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 |
666
| `jobs_enabled` | boolean | no | Enable jobs for this project |
667 668
| `wiki_enabled` | boolean | no | Enable wiki for this project |
| `snippets_enabled` | boolean | no | Enable snippets for this project |
669
| `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push |
670 671
| `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
672
| `visibility` | string | no | See [project visibility level](#project-visibility-level) |
673
| `import_url` | string | no | URL to import repository from |
674
| `public_builds` | boolean | no | If `true`, jobs can be viewed by non-project-members |
675
| `only_allow_merge_if_pipeline_succeeds` | boolean | no | Set whether merge requests can only be merged with successful jobs |
676
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
677
| `merge_method` | string | no | Set the merge method used |
678 679
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
680
| `tag_list`    | array   | no       | The list of tags for a project; put array of tags, that should be finally assigned to a project |
681
| `avatar`    | mixed   | no      | Image file for avatar of the project                |
682
| `printing_merge_request_link_enabled` | boolean | no | Show link to create/view merge request when pushing from the command line |
683
| `ci_config_path` | string | no | The path to CI config file |
Steve's avatar
Steve committed
684
| `initialize_with_readme` | boolean | no | `false` by default |
685

686
## Create project for user
687

688
Creates a new project owned by the specified user. Available only for admins.
689 690 691 692 693

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

694 695 696 697 698
| 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 |
699
| `default_branch` | string | no | `master` by default |
700 701 702 703
| `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 |
704
| `jobs_enabled` | boolean | no | Enable jobs for this project |
705 706
| `wiki_enabled` | boolean | no | Enable wiki for this project |
| `snippets_enabled` | boolean | no | Enable snippets for this project |
707
| `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push |
708 709
| `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
710
| `visibility` | string | no | See [project visibility level](#project-visibility-level) |
711
| `import_url` | string | no | URL to import repository from |
712
| `public_builds` | boolean | no | If `true`, jobs can be viewed by non-project-members |
713
| `only_allow_merge_if_pipeline_succeeds` | boolean | no | Set whether merge requests can only be merged with successful jobs |
714
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
715
| `merge_method` | string | no | Set the merge method used |
716 717
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
718
| `tag_list`    | array   | no       | The list of tags for a project; put array of tags, that should be finally assigned to a project |
719
| `avatar`    | mixed   | no      | Image file for avatar of the project                |
720
| `printing_merge_request_link_enabled` | boolean | no | Show link to create/view merge request when pushing from the command line |
721
| `ci_config_path` | string | no | The path to CI config file |
722

723
## Edit project
724

725
Updates an existing project.
726 727 728 729 730

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

731 732
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
733
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
734
| `name` | string | no | The name of the project |
735
| `path` | string | no | Custom repository name for the project. By default generated based on name |
736
| `default_branch` | string | no | `master` by default |
737 738 739
| `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 |
740
| `jobs_enabled` | boolean | no | Enable jobs for this project |
741 742
| `wiki_enabled` | boolean | no | Enable wiki for this project |
| `snippets_enabled` | boolean | no | Enable snippets for this project |
743
| `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push |
744 745
| `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
746
| `visibility` | string | no | See [project visibility level](#project-visibility-level) |
747
| `import_url` | string | no | URL to import repository from |
748
| `public_builds` | boolean | no | If `true`, jobs can be viewed by non-project-members |
749
| `only_allow_merge_if_pipeline_succeeds` | boolean | no | Set whether merge requests can only be merged with successful jobs |
750
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
751
| `merge_method` | string | no | Set the merge method used |
752 753
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
754
| `tag_list`    | array   | no       | The list of tags for a project; put array of tags, that should be finally assigned to a project |
755
| `avatar`    | mixed   | no      | Image file for avatar of the project                |
756
| `ci_config_path` | string | no | The path to CI config file |
757

758
## Fork project
759

760
Forks a project into the user namespace of the authenticated user or the one provided.
761

762 763 764
The forking operation for a project is asynchronous and is completed in a
background job. The request will return immediately. To determine whether the
fork of the project has completed, query the `import_status` for the new project.
765

766
```
767
POST /projects/:id/fork
768 769
```

770 771
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
772
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
773
| `namespace` | integer/string | yes | The ID or path of the namespace that the project will be forked to |
774 775
| `path` | string | no | The path that will be assigned to the resultant project after forking |
| `name` | string | no | The name that will be assigned to the resultant project after forking |
776

777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794
## List Forks of a project

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

List the projects accessible to the calling user that have an established, forked relationship with the specified project

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

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
| `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` |
| `search` | string | no | Return list of projects matching the search criteria |
795
| `simple` | boolean | no | Return only limited fields for each project. This is a no-op without authentication as then _only_ simple fields are returned. |
796
| `owned` | boolean | no | Limit by projects explicitly owned by the current user |
797 798 799
| `membership` | boolean | no | Limit by projects that the current user is a member of |
| `starred` | boolean | no | Limit by projects starred by the current user |
| `statistics` | boolean | no | Include project statistics |
800
| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) |
801 802
| `with_issues_enabled` | boolean | no | Limit by enabled issues feature |
| `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature |
803
| `min_access_level` | integer | no | Limit by current user minimal [access level](members.md) |
804 805

```bash
806
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/forks"
807 808 809 810 811 812 813 814 815 816 817 818 819 820
```

Example responses:

```json
[
  {
    "id": 3,
    "description": null,
    "default_branch": "master",
    "visibility": "internal",
    "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",
821
    "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858
    "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,
    "jobs_enabled": true,
    "wiki_enabled": true,
    "snippets_enabled": false,
    "resolve_outdated_diff_discussions": false,
    "container_registry_enabled": false,
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
    "creator_id": 3,
    "namespace": {
      "id": 3,
      "name": "Diaspora",
      "path": "diaspora",
      "kind": "group",
      "full_path": "diaspora"
    },
    "import_status": "none",
    "archived": true,
    "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
    "shared_runners_enabled": true,
    "forks_count": 0,
    "star_count": 1,
    "public_jobs": true,
    "shared_with_groups": [],
    "only_allow_merge_if_pipeline_succeeds": false,
    "only_allow_merge_if_all_discussions_are_resolved": false,
    "request_access_enabled": false,
859
    "merge_method": "merge",
860 861 862 863 864 865 866 867 868 869 870 871 872
    "_links": {
      "self": "http://example.com/api/v4/projects",
      "issues": "http://example.com/api/v4/projects/1/issues",
      "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
      "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
      "labels": "http://example.com/api/v4/projects/1/labels",
      "events": "http://example.com/api/v4/projects/1/events",
      "members": "http://example.com/api/v4/projects/1/members"
    }
  }
]
```

873
## Star a project
874

875
Stars a given project. Returns status code `304` if the project is already starred.
876 877 878 879 880 881 882

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

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

```bash
886
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/star"
887 888 889 890 891 892 893 894 895
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
896
  "visibility": "internal",
897 898 899
  "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",
900
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
901 902 903 904 905 906 907 908 909 910 911
  "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,
912
  "jobs_enabled": true,
913 914
  "wiki_enabled": true,
  "snippets_enabled": false,
915
  "resolve_outdated_diff_discussions": false,
916
  "container_registry_enabled": false,
Ben Boeckel's avatar
Ben Boeckel committed
917 918
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
919 920 921 922 923
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
924 925
    "kind": "group",
    "full_path": "diaspora"
926
  },
927
  "import_status": "none",
928 929
  "archived": true,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
930 931 932 933 934 935 936 937
  "license_url": "http://example.com/diaspora/diaspora-client/blob/master/LICENSE",
  "license": {
    "key": "lgpl-3.0",
    "name": "GNU Lesser General Public License v3.0",
    "nickname": "GNU LGPLv3",
    "html_url": "http://choosealicense.com/licenses/lgpl-3.0/",
    "source_url": "http://www.gnu.org/licenses/lgpl-3.0.txt"
  },
938 939
  "shared_runners_enabled": true,
  "forks_count": 0,
940
  "star_count": 1,
941
  "public_jobs": true,
942
  "shared_with_groups": [],
943
  "only_allow_merge_if_pipeline_succeeds": false,
944
  "only_allow_merge_if_all_discussions_are_resolved": false,
945
  "request_access_enabled": false,
946
  "merge_method": "merge",
947 948 949 950 951 952 953 954 955
  "_links": {
    "self": "http://example.com/api/v4/projects",
    "issues": "http://example.com/api/v4/projects/1/issues",
    "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
    "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
    "labels": "http://example.com/api/v4/projects/1/labels",
    "events": "http://example.com/api/v4/projects/1/events",
    "members": "http://example.com/api/v4/projects/1/members"
  }
956 957 958
}
```

959
## Unstar a project
960

961
Unstars a given project. Returns status code `304` if the project is not starred.
962 963

```
964
POST /projects/:id/unstar
965 966 967 968
```

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

```bash
972
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/unstar"
973 974 975 976 977 978 979 980 981
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
982
  "visibility": "internal",
983 984 985
  "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",
986
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
987 988 989 990 991 992 993 994 995 996 997
  "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,
998
  "jobs_enabled": true,
999 1000
  "wiki_enabled": true,
  "snippets_enabled": false,
1001
  "resolve_outdated_diff_discussions": false,
1002
  "container_registry_enabled": false,
Ben Boeckel's avatar
Ben Boeckel committed
1003 1004
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1005 1006 1007 1008 1009
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1010 1011
    "kind": "group",
    "full_path": "diaspora"
1012
  },
1013
  "import_status": "none",
1014 1015
  "archived": true,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
1016 1017 1018 1019 1020 1021 1022 1023
  "license_url": "http://example.com/diaspora/diaspora-client/blob/master/LICENSE",
  "license": {
    "key": "lgpl-3.0",
    "name": "GNU Lesser General Public License v3.0",
    "nickname": "GNU LGPLv3",
    "html_url": "http://choosealicense.com/licenses/lgpl-3.0/",
    "source_url": "http://www.gnu.org/licenses/lgpl-3.0.txt"
  },
1024 1025
  "shared_runners_enabled": true,
  "forks_count": 0,
1026
  "star_count": 0,
1027
  "public_jobs": true,
1028
  "shared_with_groups": [],
1029
  "only_allow_merge_if_pipeline_succeeds": false,
1030
  "only_allow_merge_if_all_discussions_are_resolved": false,
1031
  "request_access_enabled": false,
1032
  "merge_method": "merge",
1033 1034 1035 1036 1037 1038 1039 1040 1041
  "_links": {
    "self": "http://example.com/api/v4/projects",
    "issues": "http://example.com/api/v4/projects/1/issues",
    "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
    "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
    "labels": "http://example.com/api/v4/projects/1/labels",
    "events": "http://example.com/api/v4/projects/1/events",
    "members": "http://example.com/api/v4/projects/1/members"
  }
1042 1043 1044
}
```

1045 1046 1047 1048 1049 1050 1051 1052 1053
## Languages

Get languages used in a project with percentage value.

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

```bash
1054
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/languages"
1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067
```

Example response:

```json
{
  "Ruby": 66.69,
  "JavaScript": 22.98,
  "HTML": 7.91,
  "CoffeeScript": 2.42
}
```

1068
## Archive a project
1069

1070
Archives the project if the user is either admin or the project owner of this project. This action is
1071 1072 1073
idempotent, thus archiving an already archived project will not change the project.

```
1074
POST /projects/:id/archive
1075 1076 1077 1078
```

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

```bash
1082
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/archive"
1083 1084 1085 1086 1087 1088 1089 1090 1091
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
1092
  "visibility": "private",
1093 1094 1095
  "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",
1096
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1097 1098 1099 1100 1101 1102 1103
  "tag_list": [
    "example",
    "disapora project"
  ],
  "owner": {
    "id": 3,
    "name": "Diaspora",
Ben Boeckel's avatar
Ben Boeckel committed
1104
    "created_at": "2013-09-30T13:46:02Z"
1105 1106 1107 1108 1109 1110 1111 1112
  },
  "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,
1113
  "jobs_enabled": true,
1114 1115
  "wiki_enabled": true,
  "snippets_enabled": false,
1116
  "resolve_outdated_diff_discussions": false,
1117
  "container_registry_enabled": false,
Ben Boeckel's avatar
Ben Boeckel committed
1118 1119
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1120 1121 1122 1123 1124
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1125 1126
    "kind": "group",
    "full_path": "diaspora"
1127
  },
1128 1129
  "import_status": "none",
  "import_error": null,
1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141
  "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",
1142 1143 1144 1145 1146 1147 1148 1149
  "license_url": "http://example.com/diaspora/diaspora-client/blob/master/LICENSE",
  "license": {
    "key": "lgpl-3.0",
    "name": "GNU Lesser General Public License v3.0",
    "nickname": "GNU LGPLv3",
    "html_url": "http://choosealicense.com/licenses/lgpl-3.0/",
    "source_url": "http://www.gnu.org/licenses/lgpl-3.0.txt"
  },
1150 1151 1152
  "shared_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
1153
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
1154
  "public_jobs": true,
1155
  "shared_with_groups": [],
1156
  "only_allow_merge_if_pipeline_succeeds": false,
1157
  "only_allow_merge_if_all_discussions_are_resolved": false,
1158
  "request_access_enabled": false,
1159
  "merge_method": "merge",
1160 1161 1162 1163 1164 1165 1166 1167 1168
  "_links": {
    "self": "http://example.com/api/v4/projects",
    "issues": "http://example.com/api/v4/projects/1/issues",
    "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
    "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
    "labels": "http://example.com/api/v4/projects/1/labels",
    "events": "http://example.com/api/v4/projects/1/events",
    "members": "http://example.com/api/v4/projects/1/members"
  }
1169 1170 1171
}
```

1172
## Unarchive a project
1173

1174
Unarchives the project if the user is either admin or the project owner of this project. This action is
Ville Skyttä's avatar
Ville Skyttä committed
1175
idempotent, thus unarchiving a non-archived project will not change the project.
1176 1177

```
Sergey Gnuskov's avatar
Sergey Gnuskov committed
1178
POST /projects/:id/unarchive
1179 1180 1181 1182
```

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

```bash
1186
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/unarchive"
1187 1188 1189 1190 1191 1192 1193 1194 1195
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
1196
  "visibility": "private",
1197 1198 1199
  "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",
1200
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1201 1202 1203 1204 1205 1206 1207
  "tag_list": [
    "example",
    "disapora project"
  ],
  "owner": {
    "id": 3,
    "name": "Diaspora",
Ben Boeckel's avatar
Ben Boeckel committed
1208
    "created_at": "2013-09-30T13:46:02Z"
1209 1210 1211 1212 1213 1214 1215 1216
  },
  "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,
1217
  "jobs_enabled": true,
1218 1219
  "wiki_enabled": true,
  "snippets_enabled": false,
1220
  "resolve_outdated_diff_discussions": false,
1221
  "container_registry_enabled": false,
Ben Boeckel's avatar
Ben Boeckel committed
1222 1223
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1224 1225 1226 1227 1228
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1229 1230
    "kind": "group",
    "full_path": "diaspora"
1231
  },
1232 1233
  "import_status": "none",
  "import_error": null,
1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245
  "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",
1246 1247 1248 1249 1250 1251 1252 1253
  "license_url": "http://example.com/diaspora/diaspora-client/blob/master/LICENSE",
  "license": {
    "key": "lgpl-3.0",
    "name": "GNU Lesser General Public License v3.0",
    "nickname": "GNU LGPLv3",
    "html_url": "http://choosealicense.com/licenses/lgpl-3.0/",
    "source_url": "http://www.gnu.org/licenses/lgpl-3.0.txt"
  },
1254 1255 1256
  "shared_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
1257
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
1258
  "public_jobs": true,
1259
  "shared_with_groups": [],
1260
  "only_allow_merge_if_pipeline_succeeds": false,
1261
  "only_allow_merge_if_all_discussions_are_resolved": false,
1262
  "request_access_enabled": false,
1263
  "merge_method": "merge",
1264 1265 1266 1267 1268 1269 1270 1271 1272
  "_links": {
    "self": "http://example.com/api/v4/projects",
    "issues": "http://example.com/api/v4/projects/1/issues",
    "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
    "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
    "labels": "http://example.com/api/v4/projects/1/labels",
    "events": "http://example.com/api/v4/projects/1/events",
    "members": "http://example.com/api/v4/projects/1/members"
  }
1273 1274 1275
}
```

1276
## Remove project
1277

1278
Removes a project including all associated resources (issues, merge requests etc.)
1279 1280 1281 1282 1283

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

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

1288
## Upload a file
1289 1290 1291 1292 1293 1294 1295

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

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

1296 1297
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1298
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1299
| `file` | string | yes | The file to be uploaded |
1300

1301 1302 1303 1304 1305 1306
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
1307
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form "file=@dk.png" https://gitlab.example.com/api/v4/projects/5/uploads
1308 1309 1310 1311
```

Returned object:

1312 1313 1314 1315 1316 1317 1318 1319
```json
{
  "alt": "dk",
  "url": "/uploads/66dbcd21ec5d24ed6ea225176098d52b/dk.png",
  "markdown": "![dk](/uploads/66dbcd21ec5d24ed6ea225176098d52b/dk.png)"
}
```

1320
>**Note**: The returned `url` is relative to the project path.
1321 1322
In Markdown contexts, the link is automatically expanded when the format in
`markdown` is used.
1323

1324
## Share project with group
1325 1326 1327 1328 1329 1330 1331

Allow to share project with group.

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

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