projects.md 57 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 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792
## 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 |
793
| `simple` | boolean | no | Return only limited fields for each project. This is a no-op without authentication as then _only_ simple fields are returned. |
794
| `owned` | boolean | no | Limit by projects explicitly owned by the current user |
795 796 797
| `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 |
798
| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) |
799 800
| `with_issues_enabled` | boolean | no | Limit by enabled issues feature |
| `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature |
801
| `min_access_level` | integer | no | Limit by current user minimal [access level](members.md) |
802 803

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

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",
819
    "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
820 821 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
    "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,
857
    "merge_method": "merge",
858 859 860 861 862 863 864 865 866 867 868 869 870
    "_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"
    }
  }
]
```

871
## Star a project
872

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

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

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

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

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
894
  "visibility": "internal",
895 896 897
  "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",
898
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
899 900 901 902 903 904 905 906 907 908 909
  "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,
910
  "jobs_enabled": true,
911 912
  "wiki_enabled": true,
  "snippets_enabled": false,
913
  "resolve_outdated_diff_discussions": false,
914
  "container_registry_enabled": false,
Ben Boeckel's avatar
Ben Boeckel committed
915 916
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
917 918 919 920 921
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
922 923
    "kind": "group",
    "full_path": "diaspora"
924
  },
925
  "import_status": "none",
926 927
  "archived": true,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
928 929 930 931 932 933 934 935
  "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"
  },
936 937
  "shared_runners_enabled": true,
  "forks_count": 0,
938
  "star_count": 1,
939
  "public_jobs": true,
940
  "shared_with_groups": [],
941
  "only_allow_merge_if_pipeline_succeeds": false,
942
  "only_allow_merge_if_all_discussions_are_resolved": false,
943
  "request_access_enabled": false,
944
  "merge_method": "merge",
945 946 947 948 949 950 951 952 953
  "_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"
  }
954 955 956
}
```

957
## Unstar a project
958

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

```
962
POST /projects/:id/unstar
963 964 965 966
```

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

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

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
980
  "visibility": "internal",
981 982 983
  "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",
984
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
985 986 987 988 989 990 991 992 993 994 995
  "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,
996
  "jobs_enabled": true,
997 998
  "wiki_enabled": true,
  "snippets_enabled": false,
999
  "resolve_outdated_diff_discussions": false,
1000
  "container_registry_enabled": false,
Ben Boeckel's avatar
Ben Boeckel committed
1001 1002
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1003 1004 1005 1006 1007
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1008 1009
    "kind": "group",
    "full_path": "diaspora"
1010
  },
1011
  "import_status": "none",
1012 1013
  "archived": true,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
1014 1015 1016 1017 1018 1019 1020 1021
  "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"
  },
1022 1023
  "shared_runners_enabled": true,
  "forks_count": 0,
1024
  "star_count": 0,
1025
  "public_jobs": true,
1026
  "shared_with_groups": [],
1027
  "only_allow_merge_if_pipeline_succeeds": false,
1028
  "only_allow_merge_if_all_discussions_are_resolved": false,
1029
  "request_access_enabled": false,
1030
  "merge_method": "merge",
1031 1032 1033 1034 1035 1036 1037 1038 1039
  "_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"
  }
1040 1041 1042
}
```

1043 1044 1045 1046 1047 1048 1049 1050 1051
## Languages

Get languages used in a project with percentage value.

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

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

Example response:

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

1066
## Archive a project
1067

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

```
1072
POST /projects/:id/archive
1073 1074 1075 1076
```

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

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

Example response:

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

1170
## Unarchive a project
1171

1172
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
1173
idempotent, thus unarchiving a non-archived project will not change the project.
1174 1175

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

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

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

Example response:

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

1274
## Remove project
1275

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

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

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

1286
## Upload a file
1287 1288 1289 1290 1291 1292 1293

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

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

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

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

Returned object:

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

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

1322
## Share project with group
1323 1324 1325 1326 1327 1328 1329

Allow to share project with group.

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

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