BigW Consortium Gitlab

projects.md 21.2 KB
Newer Older
1
# Projects
2

3 4 5 6

### Project visibility level

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

Constants for project visibility levels are next:

11
* Private. `visibility_level` is `0`.
12 13 14 15
  Project access must be granted explicitly for each user.

* Internal. `visibility_level` is `10`.
  The project can be cloned by any logged in user.
16

17 18 19 20
* Public. `visibility_level` is `20`.
  The project can be cloned without any authentication.


21
## List projects
22

23
Get a list of projects accessible by the authenticated user.
24 25 26 27 28

```
GET /projects
```

29 30
Parameters:

31
- `archived` (optional) - if passed, limit by archived status
32 33
- `order_by` (optional) - Return requests ordered by `id`, `name`, `path`, `created_at`, `updated_at` or `last_activity_at` fields. Default is `created_at`
- `sort` (optional) - Return requests sorted in `asc` or `desc` order. Default is `desc`
34
- `search` (optional) - Return list of authorized projects according to a search criteria
35

36 37 38
```json
[
  {
39
    "id": 4,
40 41
    "description": null,
    "default_branch": "master",
42
    "public": false,
43
    "visibility_level": 0,
44 45 46
    "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",
47 48 49 50
    "tag_list": [
      "example",
      "disapora client"
    ],
51
    "owner": {
52 53 54
      "id": 3,
      "name": "Diaspora",
      "created_at": "2013-09-30T13: 46: 02Z"
55
    },
56 57 58 59 60
    "name": "Diaspora Client",
    "name_with_namespace": "Diaspora / Diaspora Client",
    "path": "diaspora-client",
    "path_with_namespace": "diaspora/diaspora-client",
    "issues_enabled": true,
61
    "open_issues_count": 1,
62
    "merge_requests_enabled": true,
63
    "builds_enabled": true,
64
    "wiki_enabled": true,
65 66 67
    "snippets_enabled": false,
    "created_at": "2013-09-30T13: 46: 02Z",
    "last_activity_at": "2013-09-30T13: 46: 02Z",
68
    "creator_id": 3,
69 70 71 72 73 74 75 76
    "namespace": {
      "created_at": "2013-09-30T13: 46: 02Z",
      "description": "",
      "id": 3,
      "name": "Diaspora",
      "owner_id": 1,
      "path": "diaspora",
      "updated_at": "2013-09-30T13: 46: 02Z"
77
    },
78 79
    "archived": false,
    "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png"
80 81
  },
  {
82
    "id": 6,
83
    "description": null,
84 85
    "default_branch": "master",
    "public": false,
86
    "visibility_level": 0,
87 88 89
    "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",
90 91 92 93
    "tag_list": [
      "example",
      "puppet"
    ],
94
    "owner": {
95 96 97
      "id": 4,
      "name": "Brightbox",
      "created_at": "2013-09-30T13:46:02Z"
98
    },
99 100 101 102
    "name": "Puppet",
    "name_with_namespace": "Brightbox / Puppet",
    "path": "puppet",
    "path_with_namespace": "brightbox/puppet",
103
    "issues_enabled": true,
104
    "open_issues_count": 1,
105
    "merge_requests_enabled": true,
106
    "builds_enabled": true,
107
    "wiki_enabled": true,
108 109 110
    "snippets_enabled": false,
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
111
    "creator_id": 3,
112
    "namespace": {
113 114 115 116 117 118 119
      "created_at": "2013-09-30T13:46:02Z",
      "description": "",
      "id": 4,
      "name": "Brightbox",
      "owner_id": 1,
      "path": "brightbox",
      "updated_at": "2013-09-30T13:46:02Z"
120
    },
121 122 123 124 125 126 127 128 129 130
    "permissions": {
      "project_access": {
        "access_level": 10,
        "notification_level": 3
      },
      "group_access": {
        "access_level": 50,
        "notification_level": 3
      }
    },
131 132
    "archived": false,
    "avatar_url": null
133 134 135 136
  }
]
```

137
### List owned projects
138

139
Get a list of projects which are owned by the authenticated user.
140 141 142 143 144

```
GET /projects/owned
```

145 146 147 148 149
Parameters:

- `archived` (optional) - if passed, limit by archived status
- `order_by` (optional) - Return requests ordered by `id`, `name`, `path`, `created_at`, `updated_at` or `last_activity_at` fields. Default is `created_at`
- `sort` (optional) - Return requests sorted in `asc` or `desc` order. Default is `desc`
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
- `search` (optional) - Return list of authorized projects according to a search criteria

### List starred projects

Get a list of projects which are starred by the authenticated user.

```
GET /projects/starred
```

Parameters:

- `archived` (optional) - if passed, limit by archived status
- `order_by` (optional) - Return requests ordered by `id`, `name`, `path`, `created_at`, `updated_at` or `last_activity_at` fields. Default is `created_at`
- `sort` (optional) - Return requests sorted in `asc` or `desc` order. Default is `desc`
165 166
- `search` (optional) - Return list of authorized projects according to a search criteria

167
### List ALL projects
168 169 170 171 172 173 174

Get a list of all GitLab projects (admin only).

```
GET /projects/all
```

175 176 177 178 179 180 181
Parameters:

- `archived` (optional) - if passed, limit by archived status
- `order_by` (optional) - Return requests ordered by `id`, `name`, `path`, `created_at`, `updated_at` or `last_activity_at` fields. Default is `created_at`
- `sort` (optional) - Return requests sorted in `asc` or `desc` order. Default is `desc`
- `search` (optional) - Return list of authorized projects according to a search criteria

182
### Get single project
183

184
Get a specific project, identified by project ID or NAMESPACE/PROJECT_NAME, which is owned by the authenticated user.
Marin Jankovski committed
185
If using namespaced projects call make sure that the NAMESPACE/PROJECT_NAME is URL-encoded, eg. `/api/v3/projects/diaspora%2Fdiaspora` (where `/` is represented by `%2F`).
186 187 188 189 190 191 192

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

Parameters:

193
- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
194

195 196
```json
{
197
  "id": 3,
198
  "description": null,
199 200
  "default_branch": "master",
  "public": false,
201
  "visibility_level": 0,
202 203 204
  "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",
205 206 207 208
  "tag_list": [
    "example",
    "disapora project"
  ],
209
  "owner": {
210 211 212
    "id": 3,
    "name": "Diaspora",
    "created_at": "2013-09-30T13: 46: 02Z"
213
  },
214 215 216 217
  "name": "Diaspora Project Site",
  "name_with_namespace": "Diaspora / Diaspora Project Site",
  "path": "diaspora-project-site",
  "path_with_namespace": "diaspora/diaspora-project-site",
218
  "issues_enabled": true,
219
  "open_issues_count": 1,
220
  "merge_requests_enabled": true,
221
  "builds_enabled": true,
222
  "wiki_enabled": true,
223 224 225
  "snippets_enabled": false,
  "created_at": "2013-09-30T13: 46: 02Z",
  "last_activity_at": "2013-09-30T13: 46: 02Z",
226
  "creator_id": 3,
227 228 229 230 231 232 233 234
  "namespace": {
    "created_at": "2013-09-30T13: 46: 02Z",
    "description": "",
    "id": 3,
    "name": "Diaspora",
    "owner_id": 1,
    "path": "diaspora",
    "updated_at": "2013-09-30T13: 46: 02Z"
235
  },
Dmitriy Zaporozhets committed
236 237 238 239 240 241 242 243 244
  "permissions": {
    "project_access": {
      "access_level": 10,
      "notification_level": 3
    },
    "group_access": {
      "access_level": 50,
      "notification_level": 3
    }
245
  },
246 247
  "archived": false,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png"
248 249 250
}
```

251 252
### Get project events

253
Get the events for the specified project.
254 255 256 257 258 259 260 261
Sorted from newest to latest

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

Parameters:

262
- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
263 264

```json
265 266 267 268 269 270 271 272 273
[
  {
    "title": null,
    "project_id": 15,
    "action_name": "closed",
    "target_id": 830,
    "target_type": "Issue",
    "author_id": 1,
    "data": null,
274 275 276 277 278 279 280 281 282 283
    "target_title": "Public project search field",
    "author": {
      "name": "Dmitriy Zaporozhets",
      "username": "root",
      "id": 1,
      "state": "active",
      "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
      "web_url": "http://localhost:3000/u/root"
    },
    "author_username": "root"
284 285 286 287 288 289 290 291
  },
  {
    "title": null,
    "project_id": 15,
    "action_name": "opened",
    "target_id": null,
    "target_type": null,
    "author_id": 1,
292 293 294 295 296 297 298 299
    "author": {
      "name": "Dmitriy Zaporozhets",
      "username": "root",
      "id": 1,
      "state": "active",
      "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
      "web_url": "http://localhost:3000/u/root"
    },
300
    "author_username": "john",
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325
    "data": {
      "before": "50d4420237a9de7be1304607147aec22e4a14af7",
      "after": "c5feabde2d8cd023215af4d2ceeb7a64839fc428",
      "ref": "refs/heads/master",
      "user_id": 1,
      "user_name": "Dmitriy Zaporozhets",
      "repository": {
        "name": "gitlabhq",
        "url": "git@dev.gitlab.org:gitlab/gitlabhq.git",
        "description": "GitLab: self hosted Git management software. \r\nDistributed under the MIT License.",
        "homepage": "https://dev.gitlab.org/gitlab/gitlabhq"
      },
      "commits": [
        {
          "id": "c5feabde2d8cd023215af4d2ceeb7a64839fc428",
          "message": "Add simple search to projects in public area",
          "timestamp": "2013-05-13T18:18:08+00:00",
          "url": "https://dev.gitlab.org/gitlab/gitlabhq/commit/c5feabde2d8cd023215af4d2ceeb7a64839fc428",
          "author": {
            "name": "Dmitriy Zaporozhets",
            "email": "dmitriy.zaporozhets@gmail.com"
          }
        }
      ],
      "total_commits_count": 1
326
    },
327
    "target_title": null
328
  },
329 330 331 332 333 334 335 336
  {
    "title": null,
    "project_id": 15,
    "action_name": "closed",
    "target_id": 840,
    "target_type": "Issue",
    "author_id": 1,
    "data": null,
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385
    "target_title": "Finish & merge Code search PR",
    "author": {
      "name": "Dmitriy Zaporozhets",
      "username": "root",
      "id": 1,
      "state": "active",
      "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
      "web_url": "http://localhost:3000/u/root"
    },
    "author_username": "root"
  },
  {
    "title": null,
    "project_id": 15,
    "action_name": "commented on",
    "target_id": 1312,
    "target_type": "Note",
    "author_id": 1,
    "data": null,
    "target_title": null,
    "created_at": "2015-12-04T10:33:58.089Z",
    "note": {
      "id": 1312,
      "body": "What an awesome day!",
      "attachment": null,
      "author": {
        "name": "Dmitriy Zaporozhets",
        "username": "root",
        "id": 1,
        "state": "active",
        "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
        "web_url": "http://localhost:3000/u/root"
      },
      "created_at": "2015-12-04T10:33:56.698Z",
      "system": false,
      "upvote": false,
      "downvote": false,
      "noteable_id": 377,
      "noteable_type": "Issue"
    },
    "author": {
      "name": "Dmitriy Zaporozhets",
      "username": "root",
      "id": 1,
      "state": "active",
      "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
      "web_url": "http://localhost:3000/u/root"
    },
    "author_username": "root"
386 387
  }
]
388 389
```

390
### Create project
391

392
Creates a new project owned by the authenticated user.
393 394 395 396 397 398 399

```
POST /projects
```

Parameters:

400
- `name` (required) - new project name
401
- `path` (optional) - custom repository name for new project. By default generated based on name
402 403 404 405
- `namespace_id` (optional) - namespace for the new project (defaults to user)
- `description` (optional) - short project description
- `issues_enabled` (optional)
- `merge_requests_enabled` (optional)
406
- `builds_enabled` (optional)
407 408 409 410 411
- `wiki_enabled` (optional)
- `snippets_enabled` (optional)
- `public` (optional) - if `true` same as setting visibility_level = 20
- `visibility_level` (optional)
- `import_url` (optional)
412

413 414
### Create project for user

415
Creates a new project owned by the specified user. Available only for admins.
416 417 418 419 420 421 422

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

Parameters:

423 424 425 426 427
- `user_id` (required) - user_id of owner
- `name` (required) - new project name
- `description` (optional) - short project description
- `issues_enabled` (optional)
- `merge_requests_enabled` (optional)
428
- `builds_enabled` (optional)
429 430 431 432 433
- `wiki_enabled` (optional)
- `snippets_enabled` (optional)
- `public` (optional) - if `true` same as setting visibility_level = 20
- `visibility_level` (optional)
- `import_url` (optional)
434

435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
### Edit project

Updates an existing project

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

Parameters:

- `id` (required) - The ID of a project
- `name` (optional) - project name
- `path` (optional) - repository name for project
- `description` (optional) - short project description
- `default_branch` (optional)
- `issues_enabled` (optional)
- `merge_requests_enabled` (optional)
452
- `builds_enabled` (optional)
453 454 455 456 457
- `wiki_enabled` (optional)
- `snippets_enabled` (optional)
- `public` (optional) - if `true` same as setting visibility_level = 20
- `visibility_level` (optional)

458
On success, method returns 200 with the updated project. If parameters are
459 460
invalid, 400 is returned.

461 462 463 464 465 466 467 468 469 470 471 472
### Fork project

Forks a project into the user namespace of the authenticated user.

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

Parameters:

- `id` (required) - The ID of the project to be forked

473
### Remove project
474

475
Removes a project including all associated resources (issues, merge requests etc.)
476 477 478 479 480 481 482

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

Parameters:

483
- `id` (required) - The ID of a project
484

485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512
## Uploads

### Upload a file

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

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

Parameters:

- `id` (required) - The ID of the project
- `file` (required) - The file to be uploaded

```json
{
  "alt": "dk",
  "url": "/uploads/66dbcd21ec5d24ed6ea225176098d52b/dk.png",
  "is_image": true,
  "markdown": "![dk](/uploads/66dbcd21ec5d24ed6ea225176098d52b/dk.png)"
}
```

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


513 514 515
## Team members

### List project team members
516

517
Get a list of a project's team members.
518 519

```
520
GET /projects/:id/members
521 522 523 524
```

Parameters:

525 526
- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
- `query` (optional) - Query string to search for members
527 528

### Get project team member
529

530
Gets a project team member.
531

532 533 534 535 536
```
GET /projects/:id/members/:user_id
```

Parameters:
537

538 539
- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
- `user_id` (required) - The ID of a user
540 541 542 543

```json
{
  "id": 1,
544
  "username": "john_smith",
545 546
  "email": "john@example.com",
  "name": "John Smith",
547
  "state": "active",
548 549 550
  "created_at": "2012-05-23T08:00:58Z",
  "access_level": 40
}
551
```
552

553
### Add project team member
554

555 556
Adds a user to a project team. This is an idempotent method and can be called multiple times
with the same parameters. Adding team membership to a user that is already a member does not
557
affect the existing membership.
558 559 560

```
POST /projects/:id/members
561 562 563 564
```

Parameters:

565 566 567
- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
- `user_id` (required) - The ID of a user to add
- `access_level` (required) - Project access level
568 569

### Edit project team member
570

571
Updates a project team member to a specified access level.
572 573

```
574
PUT /projects/:id/members/:user_id
575 576 577 578
```

Parameters:

579 580 581
- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
- `user_id` (required) - The ID of a team member
- `access_level` (required) - Project access level
582 583

### Remove project team member
584

585
Removes a user from a project team.
586 587

```
588
DELETE /projects/:id/members/:user_id
589 590 591 592
```

Parameters:

593 594
- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
- `user_id` (required) - The ID of a team member
595

596 597 598
This method is idempotent and can be called multiple times with the same parameters.
Revoking team membership for a user who is not currently a team member is considered success.
Please note that the returned JSON currently differs slightly. Thus you should not
599
rely on the returned JSON structure.
600

601 602
## Hooks

603 604 605
Also called Project Hooks and Webhooks.
These are different for [System Hooks](system_hooks.md) that are system wide.

606 607
### List project hooks

608
Get a list of project hooks.
miks committed
609 610 611 612 613 614 615

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

Parameters:

616
- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
miks committed
617

618
### Get project hook
619

620
Get a specific hook for a project.
621 622 623 624 625

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

626
Parameters:
627

628 629
- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
- `hook_id` (required) - The ID of a project hook
630

631 632 633 634
```json
{
  "id": 1,
  "url": "http://example.com/hook",
635 636 637 638
  "project_id": 3,
  "push_events": "true",
  "issues_events": "true",
  "merge_requests_events": "true",
639 640
  "note_events": "true",
  "enable_ssl_verification": "true",
641 642 643 644 645 646
  "created_at": "2012-10-12T17:04:47Z"
}
```

### Add project hook

647
Adds a hook to a specified project.
miks committed
648 649 650 651 652 653 654

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

Parameters:

655 656 657 658 659
- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
- `url` (required) - The hook URL
- `push_events` - Trigger hook on push events
- `issues_events` - Trigger hook on issues events
- `merge_requests_events` - Trigger hook on merge_requests events
660
- `tag_push_events` - Trigger hook on push_tag events
661
- `note_events` - Trigger hook on note events
662
- `enable_ssl_verification` - Do SSL verification when triggering the hook
663

664 665
### Edit project hook

666
Edits a hook for a specified project.
667 668 669 670 671 672 673

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

Parameters:

674 675 676 677 678 679
- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
- `hook_id` (required) - The ID of a project hook
- `url` (required) - The hook URL
- `push_events` - Trigger hook on push events
- `issues_events` - Trigger hook on issues events
- `merge_requests_events` - Trigger hook on merge_requests events
680
- `tag_push_events` - Trigger hook on push_tag events
681
- `note_events` - Trigger hook on note events
682
- `enable_ssl_verification` - Do SSL verification when triggering the hook
683

684
### Delete project hook
miks committed
685

686
Removes a hook from a project. This is an idempotent method and can be called multiple times.
687
Either the hook is available or not.
miks committed
688 689

```
690
DELETE /projects/:id/hooks/:hook_id
miks committed
691 692 693 694
```

Parameters:

695 696
- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
- `hook_id` (required) - The ID of hook to delete
miks committed
697

698 699
Note the JSON response differs if the hook is available or not. If the project hook
is available before it is returned in the JSON response or an empty response is returned.
700 701 702 703 704 705 706 707 708 709 710 711 712

## Branches

### List branches

Lists all branches of a project.

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

Parameters:

713
- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
714

715 716 717
```json
[
  {
718
    "name": "async",
719
    "commit": {
720 721 722 723 724 725
      "id": "a2b702edecdf41f07b42653eb1abe30ce98b9fca",
      "parents": [
        {
          "id": "3f94fc7c85061973edc9906ae170cc269b07ca55"
        }
      ],
726
      "tree": "c68537c6534a02cc2b176ca1549f4ffa190b58ee",
727
      "message": "give Caolan credit where it's due (up top)",
728
      "author": {
729 730
        "name": "Jeremy Ashkenas",
        "email": "jashkenas@example.com"
731 732
      },
      "committer": {
733 734
        "name": "Jeremy Ashkenas",
        "email": "jashkenas@example.com"
735
      },
736 737
      "authored_date": "2010-12-08T21:28:50+00:00",
      "committed_date": "2010-12-08T21:28:50+00:00"
738
    },
739
    "protected": false
740 741 742 743 744
  },
  {
    "name": "gh-pages",
    "commit": {
      "id": "101c10a60019fe870d21868835f65c25d64968fc",
745 746 747 748 749
      "parents": [
        {
          "id": "9c15d2e26945a665131af5d7b6d30a06ba338aaa"
        }
      ],
750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766
      "tree": "fb5cc9d45da3014b17a876ad539976a0fb9b352a",
      "message": "Underscore.js 1.5.2",
      "author": {
        "name": "Jeremy Ashkenas",
        "email": "jashkenas@example.com"
      },
      "committer": {
        "name": "Jeremy Ashkenas",
        "email": "jashkenas@example.com"
      },
      "authored_date": "2013-09-07T12: 58: 21+00: 00",
      "committed_date": "2013-09-07T12: 58: 21+00: 00"
    },
    "protected": false
  }
]
```
767 768 769 770 771 772 773 774 775 776 777

### List single branch

Lists a specific branch of a project.

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

Parameters:

778 779
- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
- `branch` (required) - The name of the branch.
780 781 782 783 784 785 786 787 788 789 790

### Protect single branch

Protects a single branch of a project.

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

Parameters:

791 792
- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
- `branch` (required) - The name of the branch.
793 794 795 796 797 798 799 800 801 802 803

### Unprotect single branch

Unprotects a single branch of a project.

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

Parameters:

804 805
- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
- `branch` (required) - The name of the branch.
806 807 808

## Admin fork relation

809
Allows modification of the forked relationship between existing projects. Available only for admins.
810 811 812 813 814 815 816 817 818

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

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

Parameters:

819 820
- `id` (required) - The ID of the project
- `forked_from_id:` (required) - The ID of the project that was forked from
821 822 823 824 825 826 827 828 829

### Delete an existing forked from relationship

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

Parameter:

830
- `id` (required) - The ID of the project
831 832 833

## Search for projects by name

834
Search for projects by name which are accessible to the authenticated user.
835 836 837 838 839 840 841

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

Parameters:

842 843 844 845 846
- `query` (required) - A string contained in the project name
- `per_page` (optional) - number of projects to return per page
- `page` (optional) - the page to retrieve
- `order_by` (optional) - Return requests ordered by `id`, `name`, `created_at` or `last_activity_at` fields
- `sort` (optional) - Return requests sorted in `asc` or `desc` order