- 项目可见性级别
- API v5 中移除的内容
- 项目合并方法
- 列出所有项目
- 列出用户项目
- 列出用户做出贡献的项目
- 列出用户加星标的项目
- 获取单个项目
- 获取项目用户
- 列出项目的群组
- 列出项目的可共享群组
- 获取项目事件
- 创建项目
- 为用户创建项目
- 编辑项目
- 派生项目
- 列出项目的派生
- 星标一个项目
- 取消星标一个项目
- 列出项目的星标人
- 语言
- 归档一个项目
- 取消归档一个项目
- 删除项目
- 恢复标记为删除的项目
- 上传文件
- 上传项目头像
- 移除项目头像
- 与群组共享项目
- 删除群组中的共享项目链接
- 导入项目成员
- Hooks
- 派生关系
- 按名称搜索项目
- 启动项目的例行维护
- 推送规则
- 获取用户可以将项目转移到的群组
- 将项目转移到新的命名空间
- 分支
- 项目导入/导出
- 项目成员
- 项目漏洞
- 获取项目的拉取镜像详细信息
- 为项目配置拉取镜像
- 启动项目的拉镜像过程
- 项目徽章
- 下载 Git 仓库的快照
- 获取仓库存储的路径
项目 API
使用 REST API 与项目交互。
项目可见性级别
极狐GitLab 中的项目可以是私有的、内部的或公开的。 可见性级别由项目中的可见性字段确定。
有关更多信息,请阅读项目可见性。
响应中返回的字段根据经过身份验证的用户的权限而有所不同。
API v5 中移除的内容
以下参数已弃用,并计划在 API 的 v5 中移除:
-
tag_list
:改用topics
参数。 -
marked_for_deletion_at
:改用marked_for_deletion_on
参数。 仅适用于极狐GitLab 专业版或旗舰版。 -approvals_before_merge
:改用合并请求批准 API。 仅适用于极狐GitLab 专业版或旗舰版。
项目合并方法
merge_method
可以使用以下选项:
-
merge
:为每次合并创建一个合并提交,如果没有冲突,则允许合并。 -
rebase_merge
:为每次合并创建一个合并提交,但只有在可以进行快进合并时才允许合并。您可以确保目标分支将在此合并请求构建和合并后构建。 -
ff
:不创建合并提交,所有合并都是快进的,只有当分支可以快进时才允许合并。
列出所有项目
响应中的
_links.cluster_agents
参数引入于 15.0。
获取经过身份验证的用户在极狐GitLab 中获取所有可见项目的列表。 未经身份验证访问时,仅使用简单字段返回公开项目。
GET /projects
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
archived |
boolean | No | 归档状态。 |
build_coverage_regex |
string | No | 测试覆盖率解析(已废弃,计划删除)。 |
id_after |
integer | No | ID 大于指定 ID 的项目。 |
id_before |
integer | No | ID 小于指定 ID 的项目。 |
imported |
boolean | No | 当前用户从外部系统导入的项目。 |
last_activity_after |
datetime | No | 指定时间后具有最后活动的项目。格式:ISO 8601 (YYYY-MM-DDTHH:MM:SSZ )。 |
last_activity_before |
datetime | No | 指定时间前具有最后活动的项目。格式:ISO 8601 (YYYY-MM-DDTHH:MM:SSZ )。 |
membership |
boolean | No | 当前用户所属的项目。 |
min_access_level |
integer | No | 当前用户最小角色 (access_level )。 |
order_by |
string | No | 返回按 id 、name 、path 、created_at 、updated_at 、last_activity_at 或 similarity 字段排序的项目。repository_size 、storage_size 、packages_size 或 wiki_size 字段只允许管理员使用。similarity (引入于 14.1 版本)仅在搜索时可用,并且仅限于当前用户所属的项目。默认是created_at 。 |
owned |
boolean | No | 当前用户明确拥有的项目。 |
repository_checksum_failed
|
boolean | No | 存储库校验和计算失败的项目。 |
repository_storage |
string | No | 存储在 repository_storage 上的项目。(仅管理员)
|
search_namespaces |
boolean | No | 匹配搜索条件时包括上级命名空间。默认为 false 。 |
search |
string | No | 返回符合搜索条件的项目列表。 |
simple |
boolean | No | 仅返回每个项目的有限字段。如果没有进行身份验证,则为空操作,只返回简单的字段。 |
sort |
string | No | 返回按 asc 或 desc 顺序排序的项目。默认是 desc 。 |
starred |
boolean | No | 由当前用户加星标的项目。 |
statistics |
boolean | No | 包括项目统计。仅对至少具有报告者角色的用户可用。 |
topic |
string | No | 逗号分隔的主题名称。与所有给定主题匹配的项目。请参阅 topics 参数。 |
topic_id |
integer | No | 具有由主题 ID 给出的指定主题的项目。 |
visibility |
string | No | 可见性 public 、internal 或 private 。 |
wiki_checksum_failed
|
boolean | No | wiki 校验和计算失败的项目。 |
with_custom_attributes |
boolean | No | 在响应中包含自定义属性。(仅管理员) |
with_issues_enabled |
boolean | No | 启用了议题功能。 |
with_merge_requests_enabled |
boolean | No | 启用了合并请求功能。 |
with_programming_language |
string | No | 使用给定编程语言的项目。 |
updated_before |
datetime | No | 将结果限制为在指定时间之前最后更新的项目。格式:ISO 8601(YYYY-MM-DDTHH:MM:SSZ )。引入于 15.10。要使此过滤器生效,您还必须将 updated_at 提供为 order_by 参数。 |
updated_after |
datetime | No | 将结果限制为在指定时间之后最后更新的项目。格式:ISO 8601(YYYY-MM-DDTHH:MM:SSZ )。引入于 15.10。要使此过滤器生效,您还必须将 updated_at 提供为 order_by 参数。 |
此端点支持所选 order_by
选项的 keyset 分页。
当 simple=true
或用户未经身份验证时,将返回如下内容:
请求示例:
curl --request GET "https://gitlab.example.com/api/v4/projects"
响应示例:
[
{
"id": 4,
"description": null,
"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",
"default_branch": "main",
"tag_list": [
"example",
"disapora client"
],
"topics": [
"example",
"disapora client"
],
"ssh_url_to_repo": "git@gitlab.example.com:diaspora/diaspora-client.git",
"http_url_to_repo": "https://gitlab.example.com/diaspora/diaspora-client.git",
"web_url": "https://gitlab.example.com/diaspora/diaspora-client",
"avatar_url": "https://gitlab.example.com/uploads/project/avatar/4/uploads/avatar.png",
"star_count": 0,
"last_activity_at": "2013-09-30T13:46:02Z",
"namespace": {
"id": 2,
"name": "Diaspora",
"path": "diaspora",
"kind": "group",
"full_path": "diaspora",
"parent_id": null,
"avatar_url": null,
"web_url": "https://gitlab.example.com/diaspora"
}
},
{
...
}
当用户通过身份验证且未设置 simple
时,将返回如下内容:
[
{
"id": 4,
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
"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",
"updated_at": "2013-09-30T13:46:02Z",
"default_branch": "main",
"tag_list": [ //deprecated, use `topics` instead
"example",
"disapora client"
],
"topics": [
"example",
"disapora client"
],
"ssh_url_to_repo": "git@gitlab.example.com:diaspora/diaspora-client.git",
"http_url_to_repo": "https://gitlab.example.com/diaspora/diaspora-client.git",
"web_url": "https://gitlab.example.com/diaspora/diaspora-client",
"readme_url": "https://gitlab.example.com/diaspora/diaspora-client/blob/master/README.md",
"avatar_url": "https://gitlab.example.com/uploads/project/avatar/4/uploads/avatar.png",
"forks_count": 0,
"star_count": 0,
"last_activity_at": "2022-06-24T17:11:26.841Z",
"namespace": {
"id": 3,
"name": "Diaspora",
"path": "diaspora",
"kind": "group",
"full_path": "diaspora",
"parent_id": null,
"avatar_url": "https://gitlab.example.com/uploads/project/avatar/6/uploads/avatar.png",
"web_url": "https://gitlab.example.com/diaspora"
},
"container_registry_image_prefix": "registry.gitlab.example.com/diaspora/diaspora-client",
"_links": {
"self": "https://gitlab.example.com/api/v4/projects/4",
"issues": "https://gitlab.example.com/api/v4/projects/4/issues",
"merge_requests": "https://gitlab.example.com/api/v4/projects/4/merge_requests",
"repo_branches": "https://gitlab.example.com/api/v4/projects/4/repository/branches",
"labels": "https://gitlab.example.com/api/v4/projects/4/labels",
"events": "https://gitlab.example.com/api/v4/projects/4/events",
"members": "https://gitlab.example.com/api/v4/projects/4/members",
"cluster_agents": "https://gitlab.example.com/api/v4/projects/4/cluster_agents"
},
"packages_enabled": true,
"empty_repo": false,
"archived": false,
"visibility": "public",
"resolve_outdated_diff_discussions": false,
"container_expiration_policy": {
"cadence": "1month",
"enabled": true,
"keep_n": 1,
"older_than": "14d",
"name_regex": "",
"name_regex_keep": ".*-main",
"next_run_at": "2022-06-25T17:11:26.865Z"
},
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"jobs_enabled": true,
"snippets_enabled": true,
"container_registry_enabled": true,
"service_desk_enabled": true,
"can_create_merge_request_in": true,
"issues_access_level": "enabled",
"repository_access_level": "enabled",
"merge_requests_access_level": "enabled",
"forking_access_level": "enabled",
"wiki_access_level": "enabled",
"builds_access_level": "enabled",
"snippets_access_level": "enabled",
"pages_access_level": "enabled",
"analytics_access_level": "enabled",
"container_registry_access_level": "enabled",
"security_and_compliance_access_level": "private",
"emails_disabled": null,
"shared_runners_enabled": true,
"group_runners_enabled": true,
"lfs_enabled": true,
"creator_id": 1,
"import_url": null,
"import_type": null,
"import_status": "none",
"import_error": null,
"open_issues_count": 0,
"ci_default_git_depth": 20,
"ci_forward_deployment_enabled": true,
"ci_allow_fork_pipelines_to_run_in_parent_project": true,
"ci_job_token_scope_enabled": false,
"ci_separated_caches": true,
"public_jobs": true,
"build_timeout": 3600,
"auto_cancel_pending_pipelines": "enabled",
"ci_config_path": "",
"shared_with_groups": [],
"only_allow_merge_if_pipeline_succeeds": false,
"allow_merge_on_skipped_pipeline": null,
"restrict_user_defined_variables": false,
"request_access_enabled": true,
"only_allow_merge_if_all_discussions_are_resolved": false,
"remove_source_branch_after_merge": true,
"printing_merge_request_link_enabled": true,
"merge_method": "merge",
"squash_option": "default_off",
"enforce_auth_checks_on_uploads": true,
"suggestion_commit_message": null,
"merge_commit_template": null,
"squash_commit_template": null,
"issue_branch_template": "gitlab/%{id}-%{title}",
"auto_devops_enabled": false,
"auto_devops_deploy_strategy": "continuous",
"autoclose_referenced_issues": true,
"keep_latest_artifact": true,
"runner_token_expiration_interval": null,
"external_authorization_classification_label": "",
"requirements_enabled": false,
"requirements_access_level": "enabled",
"security_and_compliance_enabled": false,
"compliance_frameworks": [],
"permissions": {
"project_access": null,
"group_access": null
}
},
{
...
}
]
您可以通过自定义属性过滤:
GET /projects?custom_attributes[key]=value&custom_attributes[other_key]=other_value
请求示例:
curl --globoff --request GET "https://gitlab.example.com/api/v4/projects?custom_attributes[location]=Antarctica&custom_attributes[role]=Developer"
分页限制
在 13.0 及更高版本,offset-based 分页限制为 50000 条记录。Keyset 分页需要检索超出此限制的项目。
Keyset 分页仅支持 order_by=id
。其他排序选项不可用。
列出用户项目
响应中的
_links.cluster_agents
参数引入于 14.10 版本。
获取给定用户拥有的可见项目列表。未经身份验证访问时,仅返回公开项目。
先决条件:
- 如果想查看特定参数,您必需具有管理员权限或该项目的所有者角色。
user_id
中指定)命名空间中的项目。不返回任何群组或子组中用户拥有的项目。如果配置文件设置为私有,则返回一个空列表。此端点支持所选 order_by
选项的 keyset 分页。
GET /users/:user_id/projects
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
archived |
boolean | No | 归档状态。 |
id_after |
integer | No | ID 大于指定 ID 的项目。 |
id_before |
integer | No | ID 小于指定 ID 的项目。 |
user_id |
string | Yes | 用户的 ID 或用户名。 |
membership |
boolean | No | 当前用户所属的项目。 |
min_access_level |
integer | No | 当前用户最低角色 (access_level )。 |
order_by |
string | No | 返回按 id 、name 、path 、created_at 、updated_at 或 last_activity_at 字段排序的项目。默认是created_at 。 |
owned |
boolean | No | 当前用户明确拥有的项目。 |
search |
string | No | 返回符合搜索条件的项目列表。 |
simple |
boolean | No | 仅返回每个项目的有限字段。如果没有进行身份验证,则为空操作,只返回简单的字段。 |
sort |
string | No | 返回按 asc 或 desc 顺序排序的项目。默认是 desc 。 |
starred |
boolean | No | 由当前用户加星标的项目。 |
statistics |
boolean | No | 包括项目统计。仅对至少具有报告者角色的用户可用。 |
visibility |
string | No | 可见性 public 、internal 或 private 。 |
with_custom_attributes |
boolean | No | 在响应中包含自定义属性。(仅管理员) |
with_issues_enabled |
boolean | No | 启用了议题功能。 |
with_merge_requests_enabled |
boolean | No | 启用了合并请求功能。 |
with_programming_language |
string | No | 使用给定编程语言的项目。 |
updated_before |
datetime | No | 将结果限制为在指定时间之前最后更新的项目。格式:ISO 8601(YYYY-MM-DDTHH:MM:SSZ )。引入于 15.10。要使此过滤器生效,您还必须将 updated_at 提供为 order_by 参数。 |
updated_after |
datetime | No | 将结果限制为在指定时间之后最后更新的项目。格式:ISO 8601(YYYY-MM-DDTHH:MM:SSZ )。引入于 15.10。要使此过滤器生效,您还必须将 updated_at 提供为 order_by 参数。 |
[
{
"id": 4,
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
"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",
"readme_url": "http://example.com/diaspora/diaspora-client/blob/master/README.md",
"tag_list": [ //deprecated, use `topics` instead
"example",
"disapora client"
],
"topics": [
"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,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, // deprecated, use container_registry_access_level instead
"container_registry_access_level": "disabled",
"security_and_compliance_access_level": "disabled",
"created_at": "2013-09-30T13:46:02Z",
"updated_at": "2013-09-30T13:46:02Z",
"last_activity_at": "2013-09-30T13:46:02Z",
"creator_id": 3,
"import_url": null,
"import_type": null,
"import_status": "none",
"import_error": null,
"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,
"group_runners_enabled": true,
"forks_count": 0,
"star_count": 0,
"runners_token": "b8547b1dc37721d05889db52fa2f02",
"ci_default_git_depth": 50,
"ci_forward_deployment_enabled": true,
"ci_allow_fork_pipelines_to_run_in_parent_project": true,
"ci_separated_caches": true,
"public_jobs": true,
"shared_with_groups": [],
"only_allow_merge_if_pipeline_succeeds": false,
"allow_merge_on_skipped_pipeline": false,
"restrict_user_defined_variables": false,
"only_allow_merge_if_all_discussions_are_resolved": false,
"remove_source_branch_after_merge": false,
"request_access_enabled": false,
"merge_method": "merge",
"squash_option": "default_on",
"autoclose_referenced_issues": true,
"enforce_auth_checks_on_uploads": true,
"suggestion_commit_message": null,
"merge_commit_template": null,
"squash_commit_template": null,
"issue_branch_template": "gitlab/%{id}-%{title}",
"marked_for_deletion_at": "2020-04-03", // Deprecated and will be removed in API v5 in favor of marked_for_deletion_on
"marked_for_deletion_on": "2020-04-03",
"statistics": {
"commit_count": 37,
"storage_size": 1038090,
"repository_size": 1038090,
"wiki_size" : 0,
"lfs_objects_size": 0,
"job_artifacts_size": 0,
"pipeline_artifacts_size": 0,
"packages_size": 0,
"snippets_size": 0,
"uploads_size": 0
},
"container_registry_image_prefix": "registry.example.com/diaspora/diaspora-client",
"_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",
"cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
}
},
{
"id": 6,
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
"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",
"readme_url": "http://example.com/brightbox/puppet/blob/master/README.md",
"tag_list": [ //deprecated, use `topics` instead
"example",
"puppet"
],
"topics": [
"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,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, // deprecated, use container_registry_access_level instead
"container_registry_access_level": "disabled",
"security_and_compliance_access_level": "disabled",
"created_at": "2013-09-30T13:46:02Z",
"updated_at": "2013-09-30T13:46:02Z",
"last_activity_at": "2013-09-30T13:46:02Z",
"creator_id": 3,
"import_url": null,
"import_type": null,
"import_status": "none",
"import_error": null,
"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,
"group_runners_enabled": true,
"forks_count": 0,
"star_count": 0,
"runners_token": "b8547b1dc37721d05889db52fa2f02",
"ci_default_git_depth": 0,
"ci_forward_deployment_enabled": true,
"ci_allow_fork_pipelines_to_run_in_parent_project": true,
"ci_separated_caches": true,
"public_jobs": true,
"shared_with_groups": [],
"only_allow_merge_if_pipeline_succeeds": false,
"allow_merge_on_skipped_pipeline": false,
"restrict_user_defined_variables": false,
"only_allow_merge_if_all_discussions_are_resolved": false,
"remove_source_branch_after_merge": false,
"request_access_enabled": false,
"merge_method": "merge",
"squash_option": "default_on",
"auto_devops_enabled": true,
"auto_devops_deploy_strategy": "continuous",
"repository_storage": "default",
"approvals_before_merge": 0, // Deprecated. Use merge request approvals API instead.
"mirror": false,
"mirror_user_id": 45,
"mirror_trigger_builds": false,
"only_mirror_protected_branches": false,
"mirror_overwrites_diverged_branches": false,
"external_authorization_classification_label": null,
"packages_enabled": true,
"service_desk_enabled": false,
"service_desk_address": null,
"autoclose_referenced_issues": true,
"enforce_auth_checks_on_uploads": true,
"suggestion_commit_message": null,
"merge_commit_template": null,
"squash_commit_template": null,
"issue_branch_template": "gitlab/%{id}-%{title}",
"statistics": {
"commit_count": 12,
"storage_size": 2066080,
"repository_size": 2066080,
"wiki_size" : 0,
"lfs_objects_size": 0,
"job_artifacts_size": 0,
"pipeline_artifacts_size": 0,
"packages_size": 0,
"snippets_size": 0,
"uploads_size": 0
},
"container_registry_image_prefix": "registry.example.com/brightbox/puppet",
"_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",
"cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
}
}
]
列出用户做出贡献的项目
获取给定用户贡献的可见项目的列表。
GET /users/:user_id/contributed_projects
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
user_id |
string | Yes | 用户 ID 或用户名 |
order_by |
string | No | 返回按 id 、name 、path 、created_at 、updated_at 或 last_activity_at 字段排序的项目,默认为 created_at
|
simple |
boolean | No | 仅返回每个项目的有限字段。如果未进行身份认证,将不进行任何操作;仅返回简单字段 |
sort |
string | No | 返回按 asc 或 desc 顺序排序的项目,默认为 desc
|
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/5/contributed_projects"
响应示例:
[
{
"id": 4,
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
"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",
"readme_url": "http://example.com/diaspora/diaspora-client/blob/master/README.md",
"tag_list": [ //deprecated, use `topics` instead
"example",
"disapora client"
],
"topics": [
"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,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, // deprecated, use container_registry_access_level instead
"container_registry_access_level": "disabled",
"security_and_compliance_access_level": "disabled",
"created_at": "2013-09-30T13:46:02Z",
"updated_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,
"group_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,
"allow_merge_on_skipped_pipeline": false,
"restrict_user_defined_variables": false,
"only_allow_merge_if_all_discussions_are_resolved": false,
"remove_source_branch_after_merge": false,
"request_access_enabled": false,
"merge_method": "merge",
"squash_option": "default_on",
"autoclose_referenced_issues": true,
"enforce_auth_checks_on_uploads": true,
"suggestion_commit_message": null,
"merge_commit_template": null,
"squash_commit_template": null,
"issue_branch_template": "gitlab/%{id}-%{title}",
"statistics": {
"commit_count": 37,
"storage_size": 1038090,
"repository_size": 1038090,
"lfs_objects_size": 0,
"job_artifacts_size": 0,
"pipeline_artifacts_size": 0,
"packages_size": 0,
"snippets_size": 0,
"uploads_size": 0
},
"container_registry_image_prefix": "registry.example.com/diaspora/diaspora-client",
"_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",
"cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
}
},
{
"id": 6,
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
"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",
"readme_url": "http://example.com/brightbox/puppet/blob/master/README.md",
"tag_list": [ //deprecated, use `topics` instead
"example",
"puppet"
],
"topics": [
"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,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, // deprecated, use container_registry_access_level instead
"container_registry_access_level": "disabled",
"security_and_compliance_access_level": "disabled",
"created_at": "2013-09-30T13:46:02Z",
"updated_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,
"group_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,
"allow_merge_on_skipped_pipeline": false,
"restrict_user_defined_variables": false,
"only_allow_merge_if_all_discussions_are_resolved": false,
"remove_source_branch_after_merge": false,
"request_access_enabled": false,
"merge_method": "merge",
"squash_option": "default_on",
"auto_devops_enabled": true,
"auto_devops_deploy_strategy": "continuous",
"repository_storage": "default",
"approvals_before_merge": 0, // Deprecated. Use merge request approvals API instead.
"mirror": false,
"mirror_user_id": 45,
"mirror_trigger_builds": false,
"only_mirror_protected_branches": false,
"mirror_overwrites_diverged_branches": false,
"external_authorization_classification_label": null,
"packages_enabled": true,
"service_desk_enabled": false,
"service_desk_address": null,
"autoclose_referenced_issues": true,
"enforce_auth_checks_on_uploads": true,
"suggestion_commit_message": null,
"merge_commit_template": null,
"squash_commit_template": null,
"issue_branch_template": "gitlab/%{id}-%{title}",
"statistics": {
"commit_count": 12,
"storage_size": 2066080,
"repository_size": 2066080,
"lfs_objects_size": 0,
"job_artifacts_size": 0,
"pipeline_artifacts_size": 0,
"packages_size": 0,
"snippets_size": 0,
"uploads_size": 0
},
"container_registry_image_prefix": "registry.example.com/brightbox/puppet",
"_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",
"cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
}
}
]
列出用户加星标的项目
响应中的参数
_links.cluster_agents
引入于 14.10 版本。
获取给定用户加星标的可见项目列表。未经身份验证访问时,仅返回公开项目。
GET /users/:user_id/starred_projects
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
user_id |
string | Yes | 用户的 ID 或用户名。 |
archived |
boolean | No | 归档状态。 |
membership |
boolean | No | 当前用户所属的项目。 |
min_access_level |
integer | No | 当前用户的最低角色 (access_level )。 |
order_by |
string | No | 返回按 id 、name 、path 、created_at 、updated_at 或 last_activity_at 字段排序的项目。默认是created_at 。 |
owned |
boolean | No | 当前用户明确拥有的项目。 |
search |
string | No | 返回符合搜索条件的项目列表。 |
simple |
boolean | No | 仅返回每个项目的有限字段。如果没有进行身份验证,则为空操作,只返回简单的字段。 |
sort |
string | No | 返回按 asc 或 desc 顺序排序的项目。默认是 desc 。 |
starred |
boolean | No | 由当前用户加星标的项目。 |
statistics |
boolean | No | 包括项目统计。仅对对至少具有报告者角色的用户可用。 |
visibility |
string | No | 可见性 public 、internal 或 private 。 |
with_custom_attributes |
boolean | No | 在响应中包含自定义属性。(仅管理员) |
with_issues_enabled |
boolean | No | 启用了议题功能。 |
with_merge_requests_enabled |
boolean | No | 启用了合并请求功能。 |
updated_before |
datetime | No | 将结果限制为特定时间之前最后更新的项目。格式:ISO 8601(YYYY-MM-DDTHH:MM:SSZ )。引入于 15.10。 |
updated_after |
datetime | No | 将结果限制为特定时间之后最后更新的项目。格式:ISO 8601(YYYY-MM-DDTHH:MM:SSZ )。引入于 15.10。 |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/5/starred_projects"
响应示例:
[
{
"id": 4,
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
"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",
"readme_url": "http://example.com/diaspora/diaspora-client/blob/master/README.md",
"tag_list": [ //deprecated, use `topics` instead
"example",
"disapora client"
],
"topics": [
"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,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, // deprecated, use container_registry_access_level instead
"container_registry_access_level": "disabled",
"security_and_compliance_access_level": "disabled",
"created_at": "2013-09-30T13:46:02Z",
"updated_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,
"group_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,
"allow_merge_on_skipped_pipeline": false,
"restrict_user_defined_variables": false,
"only_allow_merge_if_all_discussions_are_resolved": false,
"remove_source_branch_after_merge": false,
"request_access_enabled": false,
"merge_method": "merge",
"squash_option": "default_on",
"autoclose_referenced_issues": true,
"enforce_auth_checks_on_uploads": true,
"suggestion_commit_message": null,
"merge_commit_template": null,
"squash_commit_template": null,
"issue_branch_template": "gitlab/%{id}-%{title}",
"statistics": {
"commit_count": 37,
"storage_size": 1038090,
"repository_size": 1038090,
"lfs_objects_size": 0,
"job_artifacts_size": 0,
"pipeline_artifacts_size": 0,
"packages_size": 0,
"snippets_size": 0,
"uploads_size": 0
},
"container_registry_image_prefix": "registry.example.com/diaspora/diaspora-client",
"_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",
"cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
}
},
{
"id": 6,
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
"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",
"readme_url": "http://example.com/brightbox/puppet/blob/master/README.md",
"tag_list": [ //deprecated, use `topics` instead
"example",
"puppet"
],
"topics": [
"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,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, // deprecated, use container_registry_access_level instead
"container_registry_access_level": "disabled",
"security_and_compliance_access_level": "disabled",
"created_at": "2013-09-30T13:46:02Z",
"updated_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,
"group_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,
"allow_merge_on_skipped_pipeline": false,
"restrict_user_defined_variables": false,
"only_allow_merge_if_all_discussions_are_resolved": false,
"remove_source_branch_after_merge": false,
"request_access_enabled": false,
"merge_method": "merge",
"squash_option": "default_on",
"auto_devops_enabled": true,
"auto_devops_deploy_strategy": "continuous",
"repository_storage": "default",
"approvals_before_merge": 0, // Deprecated. Use merge request approvals API instead.
"mirror": false,
"mirror_user_id": 45,
"mirror_trigger_builds": false,
"only_mirror_protected_branches": false,
"mirror_overwrites_diverged_branches": false,
"external_authorization_classification_label": null,
"packages_enabled": true,
"service_desk_enabled": false,
"service_desk_address": null,
"autoclose_referenced_issues": true,
"enforce_auth_checks_on_uploads": true,
"suggestion_commit_message": null,
"merge_commit_template": null,
"squash_commit_template": null,
"issue_branch_template": "gitlab/%{id}-%{title}",
"statistics": {
"commit_count": 12,
"storage_size": 2066080,
"repository_size": 2066080,
"lfs_objects_size": 0,
"job_artifacts_size": 0,
"pipeline_artifacts_size": 0,
"packages_size": 0,
"snippets_size": 0,
"uploads_size": 0
},
"container_registry_image_prefix": "registry.example.com/brightbox/puppet",
"_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",
"cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
}
}
]
获取单个项目
响应中的参数
_links.cluster_agents
引入于 14.10 版本。
获取特定项目。如果项目可公开访问,则无需身份验证即可访问此端点。
GET /projects/:id
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | Yes | 项目的 ID 或 URL 编码的路径。 |
license |
boolean | No | 包括项目许可证数据。 |
statistics |
boolean | No | 包括项目统计。仅对至少具有报告者角色的用户可用。 |
with_custom_attributes |
boolean | No | 在响应中包含自定义属性。(仅管理员) |
{
"id": 3,
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
"default_branch": "master",
"visibility": "private",
"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",
"readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
"tag_list": [ //deprecated, use `topics` instead
"example",
"disapora project"
],
"topics": [
"example",
"disapora project"
],
"owner": {
"id": 3,
"name": "Diaspora",
"created_at": "2013-09-30T13:46:02Z"
},
"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,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, // deprecated, use container_registry_access_level instead
"container_registry_access_level": "disabled",
"security_and_compliance_access_level": "disabled",
"container_expiration_policy": {
"cadence": "7d",
"enabled": false,
"keep_n": null,
"older_than": null,
"name_regex": null, // to be deprecated in GitLab 13.0 in favor of `name_regex_delete`
"name_regex_delete": null,
"name_regex_keep": null,
"next_run_at": "2020-01-07T21:42:58.658Z"
},
"created_at": "2013-09-30T13:46:02Z",
"updated_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",
"avatar_url": "http://localhost:3000/uploads/group/avatar/3/foo.jpg",
"web_url": "http://localhost:3000/groups/diaspora"
},
"import_url": null,
"import_type": null,
"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": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
"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"
},
"shared_runners_enabled": true,
"group_runners_enabled": true,
"forks_count": 0,
"star_count": 0,
"runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
"ci_default_git_depth": 50,
"ci_forward_deployment_enabled": true,
"ci_allow_fork_pipelines_to_run_in_parent_project": true,
"ci_separated_caches": true,
"public_jobs": true,
"shared_with_groups": [
{
"group_id": 4,
"group_name": "Twitter",
"group_full_path": "twitter",
"group_access_level": 30
},
{
"group_id": 3,
"group_name": "Gitlab Org",
"group_full_path": "gitlab-org",
"group_access_level": 10
}
],
"repository_storage": "default",
"only_allow_merge_if_pipeline_succeeds": false,
"allow_merge_on_skipped_pipeline": false,
"restrict_user_defined_variables": false,
"only_allow_merge_if_all_discussions_are_resolved": false,
"remove_source_branch_after_merge": false,
"printing_merge_requests_link_enabled": true,
"request_access_enabled": false,
"merge_method": "merge",
"squash_option": "default_on",
"auto_devops_enabled": true,
"auto_devops_deploy_strategy": "continuous",
"approvals_before_merge": 0, // Deprecated. Use merge request approvals API instead.
"mirror": false,
"mirror_user_id": 45,
"mirror_trigger_builds": false,
"only_mirror_protected_branches": false,
"mirror_overwrites_diverged_branches": false,
"external_authorization_classification_label": null,
"packages_enabled": true,
"service_desk_enabled": false,
"service_desk_address": null,
"autoclose_referenced_issues": true,
"suggestion_commit_message": null,
"enforce_auth_checks_on_uploads": true,
"merge_commit_template": null,
"squash_commit_template": null,
"issue_branch_template": "gitlab/%{id}-%{title}",
"marked_for_deletion_at": "2020-04-03", // Deprecated and will be removed in API v5 in favor of marked_for_deletion_on
"marked_for_deletion_on": "2020-04-03",
"compliance_frameworks": [ "sox" ],
"statistics": {
"commit_count": 37,
"storage_size": 1038090,
"repository_size": 1038090,
"wiki_size" : 0,
"lfs_objects_size": 0,
"job_artifacts_size": 0,
"pipeline_artifacts_size": 0,
"packages_size": 0,
"snippets_size": 0,
"uploads_size": 0
},
"container_registry_image_prefix": "registry.example.com/diaspora/diaspora-client",
"_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",
"cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
}
}
15.5 及更高版本的极狐GitLab 旗舰版用户可以查看到 only_allow_merge_if_all_status_checks_passed
参数:
{
"id": 1,
"project_id": 3,
"only_allow_merge_if_all_status_checks_passed": false,
...
}
如果项目是派生项目,则 forked_from_project
字段会出现在响应中。
对于该字段,如果上游项目是私有的,则必须提供有效的身份验证令牌。
字段 mr_default_target_self
也会出现。如果此值为 false
,则默认情况下所有合并请求将针对上游项目。
{
"id":3,
...
"mr_default_target_self": false,
"forked_from_project":{
"id":13083,
"description":"GitLab Community Edition",
"name":"GitLab Community Edition",
"name_with_namespace":"GitLab.org / GitLab Community Edition",
"path":"gitlab-foss",
"path_with_namespace":"gitlab-org/gitlab-foss",
"created_at":"2013-09-26T06:02:36.000Z",
"default_branch":"master",
"tag_list":[], //deprecated, use `topics` instead
"topics":[],
"ssh_url_to_repo":"git@gitlab.com:gitlab-org/gitlab-foss.git",
"http_url_to_repo":"https://gitlab.com/gitlab-org/gitlab-foss.git",
"web_url":"https://gitlab.com/gitlab-org/gitlab-foss",
"avatar_url":"https://gitlab.com/uploads/-/system/project/avatar/13083/logo-extra-whitespace.png",
"license_url": "https://gitlab.com/gitlab-org/gitlab/-/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"
},
"star_count":3812,
"forks_count":3561,
"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
}
}
...
}
议题和合并请求的模板
引入于 13.10 版本。
专业版或旗舰版的用户还可以查看 issues_template
和 merge_requests_template
参数来管理 议题和合并请求描述模板。
{
"id": 3,
"issues_template": null,
"merge_requests_template": null,
...
}
获取项目用户
获取项目的用户列表。
GET /projects/:id/users
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | Yes | 项目的 ID 或 URL 编码的路径。 |
search |
string | No | 搜索特定用户。 |
skip_users |
integer array | No | 过滤掉具有指定 ID 的用户。 |
[
{
"id": 1,
"username": "john_smith",
"name": "John Smith",
"state": "active",
"avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
"web_url": "http://localhost:3000/john_smith"
},
{
"id": 2,
"username": "jack_smith",
"name": "Jack Smith",
"state": "blocked",
"avatar_url": "http://gravatar.com/../e32131cd8.jpeg",
"web_url": "http://localhost:3000/jack_smith"
}
]
列出项目的群组
获取此项目的上级组列表。
GET /projects/:id/groups
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | Yes | 项目的 ID 或 URL 编码的路径。 |
search |
string | No | 搜索特定群组。 |
shared_min_access_level |
integer | No | 至少具有此角色 (access_level )的共享群组。 |
shared_visible_only |
boolean | No | 用户有权访问的共享群组。 |
skip_groups |
array of integers | No | 跳过传递的群组 ID。 |
with_shared |
boolean | No | 是否包括与该群组共享的项目。默认为 false 。 |
[
{
"id": 1,
"name": "Foobar Group",
"avatar_url": "http://localhost:3000/uploads/group/avatar/1/foo.jpg",
"web_url": "http://localhost:3000/groups/foo-bar",
"full_name": "Foobar Group",
"full_path": "foo-bar"
},
{
"id": 2,
"name": "Shared Group",
"avatar_url": "http://gitlab.example.com/uploads/group/avatar/1/bar.jpg",
"web_url": "http://gitlab.example.com/groups/foo/bar",
"full_name": "Shared Group",
"full_path": "foo/shared"
}
]
列出项目的可共享群组
获取可以与项目共享的群组列表。
GET /projects/:id/share_locations
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | Yes | 项目的 ID 或 URL 编码的路径 |
search |
string | No | 搜索特定群组 |
[
{
"id": 22,
"web_url": "http://127.0.0.1:3000/groups/gitlab-org",
"name": "Gitlab Org",
"avatar_url": null,
"full_name": "Gitlab Org",
"full_path": "gitlab-org"
},
{
"id": 25,
"web_url": "http://127.0.0.1:3000/groups/gnuwget",
"name": "Gnuwget",
"avatar_url": null,
"full_name": "Gnuwget",
"full_path": "gnuwget"
}
]
获取项目事件
请参阅事件 API 文档。
创建项目
operations_access_level
移除于极狐GitLab 16.0。
创建一个由经过身份验证的用户拥有的新项目。
如果您的 HTTP 仓库不可公开访问,请将身份验证信息添加到 URL https://username:password@gitlab.company.com/group/project.git
,其中 password
是启用了 api
范围 的公共访问密钥。
POST /projects
请求示例:
curl --request POST --header "PRIVATE-TOKEN: <your-token>" \
--header "Content-Type: application/json" --data '{
"name": "new_project", "description": "New Project", "path": "new_project",
"namespace_id": "42", "initialize_with_readme": "true"}' \
--url 'https://gitlab.example.com/api/v4/projects/'
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
name |
string |
Yes(如果没有提供 path ) |
新项目的名称。如果未提供,则等于路径。 |
path |
string |
Yes(如果没有提供 name ) |
新项目的仓库名称。如果未提供,则根据名称生成(生成为带有破折号的小写字母)。从 14.9 版本开始,路径不得以特殊字符开头或结尾,并且不得包含连续的特殊字符。 |
allow_merge_on_skipped_pipeline |
boolean | No | 设置合并请求是否可以与跳过的作业合并。 |
only_allow_merge_if_all_status_checks_passed
|
boolean | No | 指示应阻止合并请求的合并,除非所有状态检查都已通过。默认为 faulse。引入于极狐GitLab 15.5,默认禁用,功能标志为 only_allow_merge_if_all_status_checks_passed 。 |
analytics_access_level |
string | No |
disabled 、private 或 enabled 。 |
approvals_before_merge
|
integer | No | 默认情况下应有多少审核者批准合并请求。要配置审批规则,请参阅合并请求审批 API。废弃于 16.0。 |
auto_cancel_pending_pipelines |
string | No | 自动取消挂起的流水线。此操作在启用状态和禁用状态之间切换,不是布尔值。 |
auto_devops_deploy_strategy |
string | No | Auto Deploy 策略(continuous 、manual 或 timed_incremental )。 |
auto_devops_enabled |
boolean | No | 为此项目启用 Auto DevOps。 |
autoclose_referenced_issues |
boolean | No | 设置是否在默认分支上自动关闭引用的议题。 |
avatar |
mixed | No | 项目头像的图像文件。 |
build_git_strategy |
string | No | Git 策略。默认为 fetch 。 |
build_timeout |
integer | No | 作业可以运行的最长时间(以秒为单位)。 |
builds_access_level |
string | No |
disabled 、private 或 enabled 。 |
ci_config_path |
string | No | CI 配置文件的路径。 |
container_expiration_policy_attributes |
hash | No | 更新此项目的镜像清理策略。接受:cadence (字符串)、keep_n (整数)、older_than (字符串)、name_regex (字符串)、name_regex_delete (字符串)、name_regex_keep (字符串)、enabled (布尔值)。有关 cadence 、keep_n 和 older_than 值的更多信息,请参阅 Container Registry 文档。 |
container_registry_access_level |
string | No | 将此项目的容器镜像库的可见性设置为 disabled 、private 或 enabled 。 |
container_registry_enabled |
boolean | No |
(已废弃)为此项目启用容器镜像库。请改用 container_registry_access_level 。 |
default_branch |
string | No |
默认分支 名称。 要求 initialize_with_readme 为 true 。 |
description |
string | No | 简短的项目描述。 |
emails_disabled |
boolean | No | 禁用电子邮件通知。 |
external_authorization_classification_label
|
string | No | 项目的分类标记。 |
forking_access_level |
string | No |
disabled 、private 或 enabled 。 |
group_with_project_templates_id
|
integer | No | 对于群组级自定义模板,指定所有自定义项目模板的来源组的 ID。为实例级模板留空。 要求 use_custom_template 为 true。 |
import_url |
string | No | 从中导入仓库的 URL。当 URL 值不为空时,您不能将 initialize_with_readme 设置为 true 。这样做可能会导致以下错误:not a git repository 。 |
initialize_with_readme |
boolean | No | 是否仅使用 README.md 文件创建 Git 仓库。默认为 false 。如果此布尔为 true ,则不得传递 import_url 或此端点的其他属性,这些属性指定仓库的替代内容。这样做可能会导致以下错误:not a git repository 。 |
issues_access_level |
string | No |
disabled 、private 或 enabled 。 |
issues_enabled |
boolean | No |
(已废弃)为此项目启用议题。请改用 issues_access_level 。 |
jobs_enabled |
boolean | No |
(已废弃)为此项目启用作业。请改用 builds_access_level 。 |
lfs_enabled |
boolean | No | 启用 LFS。 |
merge_method |
string | No | 设置使用的合并方法。 |
merge_pipelines_enabled |
boolean | No | 启用或禁用合并流水线。 |
merge_requests_access_level |
string | No |
disabled 、private 或 enabled 。 |
merge_requests_enabled |
boolean | No |
(已废弃)为此项目启用合并请求。请使用 merge_requests_access_level 代替。 |
merge_trains_enabled |
boolean | No | 启用或禁用合并队列。 |
mirror_trigger_builds
|
boolean | No | 拉镜像触发构建。 |
mirror
|
boolean | No | 在项目中启用拉镜像。 |
namespace_id |
integer | No | 新项目的命名空间(默认为当前用户的命名空间)。 |
only_allow_merge_if_all_discussions_are_resolved |
boolean | No | 设置是否只有在所有讨论都解决后才能合并合并请求。 |
only_allow_merge_if_pipeline_succeeds |
boolean | No | 设置合并请求是否只能与成功的流水线合并。此设置在项目设置中被命名为流水线必须成功。 |
packages_enabled |
boolean | No | 启用或禁用软件包库功能。 |
pages_access_level |
string | No |
disabled 、private 、enabled 或 public 。 |
printing_merge_request_link_enabled |
boolean | No | 从命令行推送时显示创建/查看合并请求的链接。 |
public_builds |
boolean | No | 如果为 true ,非项目成员可以查看作业。 |
releases_access_level |
string | No |
disabled 、private 或 enabled 。 |
environments_access_level |
string | No |
disabled 、private 或 enabled 。 |
feature_flags_access_level |
string | No |
disabled 、private 或 enabled 。 |
infrastructure_access_level |
string | No |
disabled 、private 或 enabled 。 |
monitor_access_level |
string | No |
disabled 、private 或 enabled 。 |
remove_source_branch_after_merge |
boolean | No | 默认为所有新的合并请求启用删除源分支选项。 |
repository_access_level |
string | No |
disabled 、private 或 enabled 。 |
repository_storage |
string | No | 仓库在哪个存储分片上。(仅限管理员) |
request_access_enabled |
boolean | No | 允许用户请求成员访问。 |
requirements_access_level |
string | No |
disabled 、private 或 enabled 。 |
resolve_outdated_diff_discussions |
boolean | No | 自动解决合并请求差异讨论上通过推送更改的行。 |
security_and_compliance_access_level |
string | No | (14.9 及更高版本)安全性和合规性访问级别。disabled 、private 或 enabled 。 |
shared_runners_enabled |
boolean | No | 为此项目启用共享 Runner。 |
group_runners_enabled |
boolean | No | 为项目启用群组 Runner。 |
snippets_access_level |
string | No |
disabled 、private 或 enabled 。 |
snippets_enabled |
boolean | No |
(已废弃)为此项目启用代码片段。请使用 snippets_access_level 代替。 |
squash_option |
string | No |
never 、always 、default_on 或 default_off 。 |
tag_list |
array | No | (废弃于 14.0 版本)项目的标签列表;放置最终应分配给项目的标签数组。请使用 topics 代替。 |
template_name |
string | No | 当不使用 use_custom_template 时,内置项目模板的名称。当与 use_custom_template 一起使用时,自定义项目模板的名称。 |
template_project_id
|
integer | No | 与 use_custom_template 一起使用时,自定义项目模板的项目 ID。使用项目 ID 优于使用 template_name ,因为 template_name 可能不明确。 |
topics |
array | No | 项目的主题列表;放置最终应分配给项目主题数组。引入于 14.0 版本。 |
use_custom_template
|
boolean | No | 使用自定义实例或群组(带有 group_with_project_templates_id )的项目模板。 |
visibility |
string | No | 请参阅项目可见性级别。 |
wiki_access_level |
string | No |
disabled 、private 或 enabled 。 |
wiki_enabled |
boolean | No |
(已废弃)为此项目启用 wiki。使用 wiki_access_level 代替。 |
为用户创建项目
operations_access_level
移除于极狐GitLab 16.0。
创建指定用户拥有的新项目。仅适用于管理员。
如果您的 HTTP 仓库不可公开访问,请将身份验证信息添加到 URL https://username:password@gitlab.company.com/group/project.git
,其中 password
是带有已启用 api
范围的公共访问密钥。
POST /projects/user/:user_id
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
user_id |
integer | Yes | 项目所有者的用户 ID。 |
name |
string | Yes | 新项目的名称。 |
allow_merge_on_skipped_pipeline |
boolean | No | 设置合并请求是否可以与跳过的作业合并。 |
only_allow_merge_if_all_status_checks_passed
|
boolean | No | 指示应阻止合并请求的合并,除非所有状态检查都已通过。默认为 faulse。引入于极狐GitLab 15.5,默认禁用,功能标志为 only_allow_merge_if_all_status_checks_passed 。 |
analytics_access_level |
string | No |
disabled 、private 或 enabled 。 |
approvals_before_merge
|
integer | No | 默认情况下应有多少审核者批准合并请求。废弃于 16.0。要配置审批规则,请参阅合并请求审批 API。 |
auto_cancel_pending_pipelines |
string | No | 自动取消挂起的流水线。此操作在启用状态和禁用状态之间切换,不是布尔值。 |
auto_devops_deploy_strategy |
string | No | Auto Deploy 策略(continuous 、manual 或 timed_incremental )。 |
auto_devops_enabled |
boolean | No | 为此项目启用 Auto DevOps。 |
autoclose_referenced_issues |
boolean | No | 设置是否在默认分支上自动关闭引用的议题。 |
avatar |
mixed | No | 项目头像的图像文件。 |
build_git_strategy |
string | No | Git 策略。默认为 fetch 。 |
build_timeout |
integer | No | 作业可以运行的最长时间(以秒为单位)。 |
builds_access_level |
string | No |
disabled 、private 或 enabled 。 |
ci_config_path |
string | No | CI 配置文件的路径。 |
container_registry_access_level |
string | No | 将此项目的容器镜像库的可见性设置为 disabled 、private 或 enabled 。 |
container_registry_enabled |
boolean | No |
(已废弃)为此项目启用容器镜像库。请改用 container_registry_access_level 。 |
default_branch |
string | No |
默认分支 名称。 要求 initialize_with_readme 为 true 。 |
description |
string | No | 简短的项目描述。 |
emails_disabled |
boolean | No | 禁用电子邮件通知。 |
enforce_auth_checks_on_uploads |
boolean | No | 在上传上执行授权检查。 |
external_authorization_classification_label
|
string | No | 项目的分类标记。 |
forking_access_level |
string | No |
disabled 、private 或 enabled 。 |
group_with_project_templates_id
|
integer | No | 对于群组级自定义模板,指定所有自定义项目模板的来源组的 ID。为实例级模板留空。 要求 use_custom_template 为 true。 |
import_url |
string | No | 从中导入仓库的 URL。 |
initialize_with_readme |
boolean | No | 默认为 false 。 |
issues_access_level |
string | No |
disabled 、private 或 enabled 。 |
issues_enabled |
boolean | No |
(已废弃)为此项目启用议题。请改用 issues_access_level 。 |
jobs_enabled |
boolean | No |
(已废弃)为此项目启用作业。请改用 builds_access_level 。 |
lfs_enabled |
boolean | No | 启用 LFS。 |
merge_commit_template |
string | No | 用于在合并请求中创建合并提交消息的模板。引入于 14.5 版本。 |
merge_method |
string | No | 设置使用的合并方法。 |
merge_requests_access_level |
string | No |
disabled 、private 或 enabled 。 |
merge_requests_enabled |
boolean | No |
(已废弃)为此项目启用合并请求。请使用 merge_requests_access_level 代替。 |
mirror_trigger_builds
|
boolean | No | 拉镜像触发构建。 |
mirror
|
boolean | No | 在项目中启用拉镜像。 |
namespace_id |
integer | No | 新项目的命名空间(默认为当前用户的命名空间)。 |
only_allow_merge_if_all_discussions_are_resolved |
boolean | No | 设置是否只有在所有讨论都解决后才能合并合并请求。 |
only_allow_merge_if_pipeline_succeeds |
boolean | No | 设置合并请求是否只能与成功的作业合并。 |
packages_enabled |
boolean | No | 启用或禁用软件包库功能。 |
pages_access_level |
string | No |
disabled 、private 、enabled 或 public 。 |
path |
string | No | 新项目的自定义存储库名称。默认根据名称生成。 |
printing_merge_request_link_enabled |
boolean | No | 从命令行推送时显示创建/查看合并请求的链接。 |
public_builds |
boolean | No | 如果为 true ,非项目成员可以查看作业。 |
releases_access_level |
string | No |
disabled 、private 或 enabled 。 |
environments_access_level |
string | No |
disabled 、private 或 enabled 。 |
feature_flags_access_level |
string | No |
disabled 、private 或 enabled 。 |
infrastructure_access_level |
string | No |
disabled 、private 或 enabled 。 |
monitor_access_level |
string | No |
disabled 、private 或 enabled 。 |
remove_source_branch_after_merge |
boolean | No | 默认为所有新的合并请求启用删除源分支选项。 |
repository_access_level |
string | No |
disabled 、private 或 enabled 。 |
repository_storage |
string | No | 仓库在哪个存储分片上。(仅限管理员) |
request_access_enabled |
boolean | No | 允许用户请求成员访问。 |
requirements_access_level |
string | No |
disabled 、private 、enabled 或 public 。 |
resolve_outdated_diff_discussions |
boolean | No | 自动解决合并请求差异讨论上通过推送更改的行。 |
security_and_compliance_access_level |
string | No | (14.9 及更高版本)安全性和合规性访问级别。disabled 、private 或 enabled 。 |
shared_runners_enabled |
boolean | No | 为此项目启用共享 Runner。 |
group_runners_enabled |
boolean | No | 启用项目的群组 Runner。 |
snippets_access_level |
string | No |
disabled 、private 或 enabled 。 |
snippets_enabled |
boolean | No |
(已废弃)为此项目启用代码片段。请使用 snippets_access_level 代替。 |
issue_branch_template |
string | No | 用于为从议题创建分支的建议名称模板。引入于极狐GitLab 15.6。 |
squash_commit_template |
string | No | 用于在合并请求中创建压缩提交消息的模板。(引入于 14.6 版本) |
squash_option |
string | No |
never 、always 、default_on 或 default_off 。 |
suggestion_commit_message |
string | No | 用于应用合并请求的提交消息建议。 |
tag_list |
array | No | (废弃于 14.0 版本)项目的标签列表;放置最终应分配给项目的标签数组。请使用 topics 代替。 |
template_name |
string | No | 当不使用 use_custom_template 时,内置项目模板的名称。当与 use_custom_template 一起使用时,自定义项目模板的名称。 |
topics |
array | No | 项目的主题列表。(引入于 14.0 版本) |
use_custom_template
|
boolean | No | 使用自定义实例或群组(带有 group_with_project_templates_id )的项目模板。 |
visibility |
string | No | 请参阅项目可见性级别。 |
wiki_access_level |
string | No |
disabled 、private 或 enabled 。 |
wiki_enabled |
boolean | No |
(已废弃)为此项目启用 wiki。使用 wiki_access_level 代替。 |
编辑项目
operations_access_level
移除于极狐GitLab 16.0。
更新现有项目。
如果您的 HTTP 仓库不可公开访问,请将身份验证信息添加到 URL https://username:password@gitlab.company.com/group/project.git
,其中 password
是带有已启用 api
范围的公共访问密钥。
PUT /projects/:id
例如:
curl --request PUT --header "PRIVATE-TOKEN: <your-token>" \
--url 'https://jihulab.com/api/v4/projects/<your-project-ID>' \
--data "shared_runners_enabled=true" # to turn off: "shared_runners_enabled=false"
支持的参数:
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | Yes | 项目的 ID 或 URL 编码的路径。 |
allow_merge_on_skipped_pipeline |
boolean | No | 设置合并请求是否可以与跳过的作业合并。 |
allow_pipeline_trigger_approve_deployment
|
boolean | No | 设置是否允许流水线触发器批准部署。 |
only_allow_merge_if_all_status_checks_passed
|
boolean | No | 指示应阻止合并请求的合并,除非所有状态检查都已通过。默认为 faulse。 引入于极狐GitLab 15.5,默认禁用,功能标志为 only_allow_merge_if_all_status_checks_passed 。功能标志默认启用于极狐GitLab 15.9。 |
analytics_access_level |
string | No |
disabled 、private 或 enabled 。 |
approvals_before_merge
|
integer | No | 默认情况下应有多少审核者批准合并请求。废弃于 16.0。要配置审批规则,请参阅合并请求审批 API。 |
auto_cancel_pending_pipelines |
string | No | 自动取消挂起的流水线。此操作在启用状态和禁用状态之间切换,不是布尔值。 |
auto_devops_deploy_strategy |
string | No | Auto Deploy 策略(continuous 、manual 或 timed_incremental )。 |
auto_devops_enabled |
boolean | No | 为此项目启用 Auto DevOps。 |
autoclose_referenced_issues |
boolean | No | 设置是否在默认分支上自动关闭引用的议题。 |
avatar |
mixed | No | 项目头像的图像文件。 |
build_git_strategy |
string | No | Git 策略。默认为 fetch 。 |
build_timeout |
integer | No | 作业可以运行的最长时间(以秒为单位)。 |
builds_access_level |
string | No |
disabled 、private 或 enabled 。 |
ci_config_path |
string | No | CI 配置文件的路径。 |
ci_default_git_depth |
integer | No | 浅克隆的默认修订数。 |
ci_forward_deployment_enabled |
boolean | No | 启用或禁用防止过期的部署作业。 |
ci_allow_fork_pipelines_to_run_in_parent_project |
boolean | No | 启用或禁用在父项目中运行来自派生的合并请求的流水线。 (在 GitLab 15.3 中引入。) |
ci_separated_caches |
boolean | No | 通过分支保护状态设置缓存是否应分离。 |
container_expiration_policy_attributes |
hash | No | 更新此项目的镜像清理策略。 接受:cadence (字符串)、keep_n (整数)、older_than (字符串)、name_regex (字符串)、name_regex_delete (字符串)、name_regex_keep (字符串)、enabled (布尔值)。 |
container_registry_access_level |
string | No | 将此项目的容器镜像库的可见性设置为 disabled 、private 或 enabled 。 |
container_registry_enabled |
boolean | No |
(已废弃)为此项目启用容器镜像库。请改用 container_registry_access_level 。 |
default_branch |
string | No | 默认分支名称。 |
description |
string | No | 简短的项目描述。 |
emails_disabled |
boolean | No | 禁用电子邮件通知。 |
enforce_auth_checks_on_uploads |
boolean | No | 在上传上执行授权检查。 |
external_authorization_classification_label
|
string | No | 项目的分类标记。 |
forking_access_level |
string | No |
disabled 、private 或 enabled 。 |
import_url |
string | No | 从中导入仓库的 URL。 |
issues_access_level |
string | No |
disabled 、private 或 enabled 。 |
issues_enabled |
boolean | No |
(已废弃)为此项目启用议题。请改用 issues_access_level 。 |
issues_template
|
string | No | 议题的默认描述。使用 GFM 解析描述。请参阅议题和合并请求的模板。 |
jobs_enabled |
boolean | No |
(已废弃)为此项目启用作业。请改用 builds_access_level 。 |
keep_latest_artifact |
boolean | No | 禁用或启用为此项目保留最新产物的能力。 |
lfs_enabled |
boolean | No | 启用 LFS。 |
merge_commit_template |
string | No | 用于在合并请求中创建合并提交消息的模板。引入于 14.5 版本。 |
merge_method |
string | No | 设置使用的合并方法。 |
merge_pipelines_enabled |
boolean | No | 启用或禁用合并流水线。 |
merge_requests_access_level |
string | No |
disabled 、private 或 enabled 。 |
merge_requests_enabled |
boolean | No |
(已废弃)为此项目启用合并请求。请使用 merge_requests_access_level 代替。 |
merge_requests_template
|
string | No | 合并请求的默认描述。使用 GFM 解析描述。请参阅议题和合并请求的模板。 |
merge_trains_enabled |
boolean | No | 启用或禁用合并队列。 |
mirror_overwrites_diverged_branches
|
boolean | No | 拉镜像覆盖分叉的分支。 |
mirror_trigger_builds
|
boolean | No | 拉镜像触发构建。 |
mirror_user_id
|
integer | No | 负责围绕拉镜像事件的所有活动的用户。(仅限管理员) |
mirror
|
boolean | No | 在项目中启用拉镜像。 |
mr_default_target_self |
boolean | No | 对于派生项目,将合并请求定位到该项目。如果为 false ,则目标是上游项目。 |
name |
string | No | 项目的名称。 |
only_allow_merge_if_all_discussions_are_resolved |
boolean | No | 设置是否只有在所有讨论都解决后才能合并合并请求。 |
only_allow_merge_if_pipeline_succeeds |
boolean | No | 设置合并请求是否只能与成功的作业合并。 |
only_mirror_protected_branches
|
boolean | No | 仅镜像受保护的分支。 |
packages_enabled |
boolean | No | 启用或禁用软件包库功能。 |
pages_access_level |
string | No |
disabled 、private 、enabled 或 public 。 |
path |
string | No | 项目的自定义仓库名称。默认根据名称生成。 |
printing_merge_request_link_enabled |
boolean | No | 从命令行推送时显示创建/查看合并请求的链接。 |
public_builds |
boolean | No | 如果为 true ,非项目成员可以查看作业。 |
releases_access_level |
string | No |
disabled 、private 或 enabled 。 |
environments_access_level |
string | No |
disabled 、private 或 enabled 。 |
feature_flags_access_level |
string | No |
disabled 、private 或 enabled 。 |
infrastructure_access_level |
string | No |
disabled 、private 或 enabled 。 |
monitor_access_level |
string | No |
disabled 、private 或 enabled 。 |
remove_source_branch_after_merge |
boolean | No | 默认为所有新的合并请求启用删除源分支选项。 |
repository_access_level |
string | No |
disabled 、private 或 enabled 。 |
repository_storage |
string | No | 仓库在哪个存储分片上。(仅限管理员) |
request_access_enabled |
boolean | No | 允许用户请求成员访问。 |
requirements_access_level |
string | No |
disabled 、private 、enabled 或 public 。 |
resolve_outdated_diff_discussions |
boolean | No | 自动解决合并请求差异讨论上通过推送更改的行。 |
restrict_user_defined_variables |
boolean | No | 仅允许具有维护者角色的用户在触发流水线时传递用户定义的变量。例如,当在 UI、API 或触发器令牌中触发流水线时。 |
security_and_compliance_access_level |
string | No | (14.9 及更高版本)安全性和合规性访问级别。disabled 、private 或 enabled 。 |
service_desk_enabled |
boolean | No | 启用或禁用服务台功能。 |
shared_runners_enabled |
boolean | No | 为此项目启用共享 Runner。 |
group_runners_enabled |
boolean | No | 启用项目的群组 Runner。 |
snippets_access_level |
string | No |
disabled 、private 或 enabled 。 |
snippets_enabled |
boolean | No |
(已废弃) 为此项目启用代码片段。请使用 snippets_access_level 代替。 |
issue_branch_template |
sstring | No | 从议题创建的分支的建议名称模板。引入于极狐GitLab 15.6。 |
squash_commit_template |
string | No | 用于在合并请求中创建压缩提交消息的模板。(引入于 14.6 版本) |
squash_option |
string | No |
never 、always 、default_on 或 default_off 。 |
suggestion_commit_message |
string | No | 用于应用合并请求建议的提交消息。 |
tag_list |
array | No | (废弃于 14.0 版本)项目的标签列表;放置最终应分配给项目的标签数组。请使用 topics 代替。 |
topics |
array | No | 项目的主题列表,将替换已添加到项目中的任何现有主题。引入于 14.0 版本。 |
visibility |
string | No | 请参阅项目可见性级别。 |
wiki_access_level |
string | No |
disabled 、private 或 enabled 。 |
wiki_enabled |
boolean | No |
(已废弃) 为此项目启用 wiki。使用 wiki_access_level 代替。 |
派生项目
将项目派生到经过身份验证的用户的或提供的命名空间中。
项目的派生操作是异步的,并在后台作业中完成。请求立即返回。要确定项目的派生是否已完成,请查询新项目的 import_status
。
POST /projects/:id/fork
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | Yes | 项目的 ID 或 URL 编码的路径。 |
description |
string | No | 派生后分配给派生项目的描述。 |
mr_default_target_self |
boolean | No | 对于派生项目,将合并请求定位到该项目。如果为 false ,则目标是上游项目。 |
name |
string | No | 派生后分配给派生项目的名称。 |
namespace_id |
integer | No | 项目派生到的命名空间的 ID。 |
namespace_path |
string | No | 项目派生到的命名空间的路径。 |
namespace |
integer or string | No | (已废弃)项目派生到的命名空间的 ID 或路径。 |
path |
string | No | 派生后分配给派生项目的路径。 |
visibility |
string | No | 派生后分配给派生项目的可见性级别。 |
列出项目的派生
响应中的参数
_links.cluster_agents
引入于 14.10 版本。
列出调用用户可访问的与指定项目建立了派生关系的项目。
GET /projects/:id/forks
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | Yes | 项目的 ID 或 URL 编码的路径。 |
membership |
boolean | No | 当前用户所属的项目。 |
min_access_level |
integer | No | 当前用户最低角色 (access_level )。 |
order_by |
string | No | 返回按 id 、name 、path 、created_at 、updated_at 或 last_activity_at 字段排序的项目。默认是created_at 。 |
owned |
boolean | No | 当前用户明确拥有的项目。 |
search |
string | No | 返回符合搜索条件的项目列表。 |
simple |
boolean | No | 仅返回每个项目的有限字段。如果没有进行身份验证,则为空操作,只返回简单的字段。 |
sort |
string | No | 返回按 asc 或 desc 顺序排序的项目。默认是 desc 。 |
starred |
boolean | No | 由当前用户加星标的项目。 |
statistics |
boolean | No | 包括项目统计。仅对至少具有报告者角色的用户可用。 |
visibility |
string | No | 可见性 public 、internal 或 private 。 |
with_custom_attributes |
boolean | No | 在响应中包含自定义属性。(仅管理员) |
with_issues_enabled |
boolean | No | 启用了议题功能。 |
with_merge_requests_enabled |
boolean | No | 启用了合并请求功能。 |
updated_before |
datetime | No | 将结果限制为在指定时间之前最后更新的项目。格式:ISO 8601 (YYYY-MM-DDTHH:MM:SSZ )。引入于 15.10。 |
updated_after |
datetime | No | 将结果限制为在指定时间之后最后更新的项目。格式:ISO 8601 (YYYY-MM-DDTHH:MM:SSZ )。引入于 15.10。 |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/forks"
响应示例:
[
{
"id": 3,
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
"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",
"readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
"tag_list": [ //deprecated, use `topics` instead
"example",
"disapora project"
],
"topics": [
"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,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, // deprecated, use container_registry_access_level instead
"container_registry_access_level": "disabled",
"security_and_compliance_access_level": "disabled",
"created_at": "2013-09-30T13:46:02Z",
"updated_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,
"group_runners_enabled": true,
"forks_count": 0,
"star_count": 1,
"public_jobs": true,
"shared_with_groups": [],
"only_allow_merge_if_pipeline_succeeds": false,
"allow_merge_on_skipped_pipeline": false,
"restrict_user_defined_variables": false,
"only_allow_merge_if_all_discussions_are_resolved": false,
"remove_source_branch_after_merge": false,
"request_access_enabled": false,
"merge_method": "merge",
"squash_option": "default_on",
"autoclose_referenced_issues": true,
"enforce_auth_checks_on_uploads": true,
"suggestion_commit_message": null,
"merge_commit_template": null,
"container_registry_image_prefix": "registry.example.com/diaspora/diaspora-project-site",
"_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",
"cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
}
}
]
星标一个项目
响应中的参数
_links.cluster_agents
引入于 14.10 版本。
为给定项目加注星标。如果项目已加星标,则返回状态码 304
。
POST /projects/:id/star
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | Yes | 项目的 ID 或 URL 编码的路径。 |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/star"
响应示例:
{
"id": 3,
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
"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",
"readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
"tag_list": [ //deprecated, use `topics` instead
"example",
"disapora project"
],
"topics": [
"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,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, // deprecated, use container_registry_access_level instead
"container_registry_access_level": "disabled",
"security_and_compliance_access_level": "disabled",
"created_at": "2013-09-30T13:46:02Z",
"updated_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",
"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"
},
"shared_runners_enabled": true,
"group_runners_enabled": true,
"forks_count": 0,
"star_count": 1,
"public_jobs": true,
"shared_with_groups": [],
"only_allow_merge_if_pipeline_succeeds": false,
"allow_merge_on_skipped_pipeline": false,
"restrict_user_defined_variables": false,
"only_allow_merge_if_all_discussions_are_resolved": false,
"remove_source_branch_after_merge": false,
"request_access_enabled": false,
"merge_method": "merge",
"squash_option": "default_on",
"autoclose_referenced_issues": true,
"enforce_auth_checks_on_uploads": true,
"suggestion_commit_message": null,
"merge_commit_template": null,
"container_registry_image_prefix": "registry.example.com/diaspora/diaspora-project-site",
"_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",
"cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
}
}
取消星标一个项目
响应中的参数
_links.cluster_agents
引入于 14.10 版本。
取消给定项目的星标。如果项目未加星标,则返回状态码 304
。
POST /projects/:id/unstar
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | Yes | 项目的 ID 或 URL 编码的路径。 |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/unstar"
响应示例:
{
"id": 3,
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
"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",
"readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
"tag_list": [ //deprecated, use `topics` instead
"example",
"disapora project"
],
"topics": [
"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,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, // deprecated, use container_registry_access_level instead
"container_registry_access_level": "disabled",
"security_and_compliance_access_level": "disabled",
"created_at": "2013-09-30T13:46:02Z",
"updated_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",
"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"
},
"shared_runners_enabled": true,
"group_runners_enabled": true,
"forks_count": 0,
"star_count": 0,
"public_jobs": true,
"shared_with_groups": [],
"only_allow_merge_if_pipeline_succeeds": false,
"allow_merge_on_skipped_pipeline": false,
"restrict_user_defined_variables": false,
"only_allow_merge_if_all_discussions_are_resolved": false,
"remove_source_branch_after_merge": false,
"request_access_enabled": false,
"merge_method": "merge",
"squash_option": "default_on",
"autoclose_referenced_issues": true,
"enforce_auth_checks_on_uploads": true,
"suggestion_commit_message": null,
"merge_commit_template": null,
"container_registry_image_prefix": "registry.example.com/diaspora/diaspora-project-site",
"_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",
"cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
}
}
列出项目的星标人
列出为指定项目加注星标的用户。
GET /projects/:id/starrers
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | Yes | 项目的 ID 或 URL 编码的路径。 |
search |
string | No | 搜索特定用户。 |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/starrers"
响应示例:
[
{
"starred_since": "2019-01-28T14:47:30.642Z",
"user": {
"id": 1,
"username": "jane_smith",
"name": "Jane Smith",
"state": "active",
"avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
"web_url": "http://localhost:3000/jane_smith"
}
},
{
"starred_since": "2018-01-02T11:40:26.570Z",
"user": {
"id": 2,
"username": "janine_smith",
"name": "Janine Smith",
"state": "blocked",
"avatar_url": "http://gravatar.com/../e32131cd8.jpeg",
"web_url": "http://localhost:3000/janine_smith"
}
}
]
语言
获取项目中使用的语言的百分比值。
GET /projects/:id/languages
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | Yes | 项目的 ID 或 URL 编码的路径。 |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/languages"
响应示例:
{
"Ruby": 66.69,
"JavaScript": 22.98,
"HTML": 7.91,
"CoffeeScript": 2.42
}
归档一个项目
响应中的参数
_links.cluster_agents
引入于 14.10 版本。
如果用户是该项目的管理员或所有者,则归档该项目。此操作是幂等的,因此归档已归档的项目不会更改项目。
POST /projects/:id/archive
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | Yes | 项目的 ID 或 URL 编码的路径。 |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/archive"
响应示例:
{
"id": 3,
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
"default_branch": "master",
"visibility": "private",
"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",
"readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
"tag_list": [ //deprecated, use `topics` instead
"example",
"disapora project"
],
"topics": [
"example",
"disapora project"
],
"owner": {
"id": 3,
"name": "Diaspora",
"created_at": "2013-09-30T13:46:02Z"
},
"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,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, // deprecated, use container_registry_access_level instead
"container_registry_access_level": "disabled",
"security_and_compliance_access_level": "disabled",
"created_at": "2013-09-30T13:46:02Z",
"updated_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",
"import_error": null,
"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",
"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"
},
"shared_runners_enabled": true,
"group_runners_enabled": true,
"forks_count": 0,
"star_count": 0,
"runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
"ci_default_git_depth": 50,
"ci_forward_deployment_enabled": true,
"ci_allow_fork_pipelines_to_run_in_parent_project": true,
"ci_separated_caches": true,
"public_jobs": true,
"shared_with_groups": [],
"only_allow_merge_if_pipeline_succeeds": false,
"allow_merge_on_skipped_pipeline": false,
"restrict_user_defined_variables": false,
"only_allow_merge_if_all_discussions_are_resolved": false,
"remove_source_branch_after_merge": false,
"request_access_enabled": false,
"merge_method": "merge",
"squash_option": "default_on",
"autoclose_referenced_issues": true,
"enforce_auth_checks_on_uploads": true,
"suggestion_commit_message": null,
"merge_commit_template": null,
"container_registry_image_prefix": "registry.example.com/diaspora/diaspora-project-site",
"_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",
"cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
}
}
取消归档一个项目
响应中的参数
_links.cluster_agents
引入于 14.10 版本。
如果用户是该项目的管理员或所有者,则取消归档该项目。此操作是幂等的,因此取消归档未归档项目不会更改项目。
POST /projects/:id/unarchive
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | Yes | 项目的 ID 或 URL 编码的路径。 |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/unarchive"
响应示例:
{
"id": 3,
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
"default_branch": "master",
"visibility": "private",
"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",
"readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
"tag_list": [ //deprecated, use `topics` instead
"example",
"disapora project"
],
"topics": [
"example",
"disapora project"
],
"owner": {
"id": 3,
"name": "Diaspora",
"created_at": "2013-09-30T13:46:02Z"
},
"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,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, // deprecated, use container_registry_access_level instead
"container_registry_access_level": "disabled",
"security_and_compliance_access_level": "disabled",
"created_at": "2013-09-30T13:46:02Z",
"updated_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",
"import_error": null,
"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",
"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"
},
"shared_runners_enabled": true,
"group_runners_enabled": true,
"forks_count": 0,
"star_count": 0,
"runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
"ci_default_git_depth": 50,
"ci_forward_deployment_enabled": true,
"ci_allow_fork_pipelines_to_run_in_parent_project": true,
"ci_separated_caches": true,
"public_jobs": true,
"shared_with_groups": [],
"only_allow_merge_if_pipeline_succeeds": false,
"allow_merge_on_skipped_pipeline": false,
"restrict_user_defined_variables": false,
"only_allow_merge_if_all_discussions_are_resolved": false,
"remove_source_branch_after_merge": false,
"request_access_enabled": false,
"merge_method": "merge",
"squash_option": "default_on",
"autoclose_referenced_issues": true,
"enforce_auth_checks_on_uploads": true,
"suggestion_commit_message": null,
"merge_commit_template": null,