mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-08-20 14:11:11 +00:00
Add an API endpoint to determine the forks of a project
This commit is contained in:
@ -635,6 +635,98 @@ POST /projects/:id/fork
|
||||
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
|
||||
| `namespace` | integer/string | yes | The ID or path of the namespace that the project will be forked to |
|
||||
|
||||
## 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 |
|
||||
| `simple` | boolean | no | Return only the ID, URL, name, and path of each project |
|
||||
| `owned` | boolean | no | Limit by projects owned by the current user |
|
||||
| `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 |
|
||||
| `with_issues_enabled` | boolean | no | Limit by enabled issues feature |
|
||||
| `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature |
|
||||
|
||||
```bash
|
||||
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/5/forks"
|
||||
```
|
||||
|
||||
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",
|
||||
"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,
|
||||
"_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"
|
||||
}
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## Star a project
|
||||
|
||||
Stars a given project. Returns status code `304` if the project is already starred.
|
||||
|
Reference in New Issue
Block a user