プロジェクトAPI
- プラン: Free、Premium、Ultimate
- 提供形態: GitLab.com、GitLab Self-Managed、GitLab Dedicated
このAPIを使用して、GitLabプロジェクトとそれに関連する設定を管理します。プロジェクトは、コードを保存し、イシューを追跡し、チームのアクティビティーを編成できる、コラボレーションの中心的なハブです。詳細については、プロジェクトを作成するを参照してください。
プロジェクトAPIには、次のエンドポイントが含まれています:
- プロジェクトの情報とメタデータを取得する
- プロジェクトを作成、編集、削除する
- プロジェクトの表示レベル、アクセス権限、セキュリティ設定を制御する
- イシュートラッキング、マージリクエスト、CI/CDなどのプロジェクト機能を管理する
- プロジェクトをアーカイブおよびアーカイブ解除する
- ネームスペース間でプロジェクトを転送する
- デプロイとコンテナレジストリの設定を管理する
権限
次のロールを持つユーザーは以下の操作を行うことができます:
- プロジェクトの任意のデフォルトロールを持つユーザーは、プロジェクトのプロパティを読み取ることができます。
- プロジェクトのオーナーまたはメンテナーのロールを持つユーザーは、プロジェクトのプロパティを編集することもできます。
プロジェクトの表示レベル
GitLabのプロジェクトには、次のいずれかの表示レベルを設定できます:
- 非公開
- 内部
- 公開
表示レベルは、プロジェクトのvisibilityフィールドによって決まります。
詳細については、プロジェクトの表示レベルを参照してください。
応答で返されるフィールドは、認証済みユーザーの権限によって異なります。
非推奨の属性
以下の属性は非推奨であり、REST APIの将来のバージョンで削除される可能性があります。代わりに代替属性を使用してください。
| 非推奨の属性 | 代替 |
|---|---|
tag_list | topics属性 |
marked_for_deletion_at | marked_for_deletion_on。PremiumおよびUltimateのみ。 |
approvals_before_merge | マージリクエスト承認API。PremiumおよびUltimateのみ。 |
単一プロジェクトを取得する
特定のプロジェクトを取得します。プロジェクトが公開されている場合、このエンドポイントには認証なしでアクセスできます。
GET /projects/:idサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
license | ブール値 | いいえ | プロジェクトのライセンスデータを含めます。 |
statistics | ブール値 | いいえ | プロジェクトの統計を含めます。レポーター以上のロールを持つユーザーのみが利用できます。 |
with_custom_attributes | ブール値 | いいえ | 応答にカスタム属性を含めます。(管理者のみ) |
応答には、コンテナレジストリのストレージサイズに関連する属性が含まれています:
container_registry_size: プロジェクト内のすべてのコンテナリポジトリで使用されるストレージサイズの合計(バイト単位)。コンテナイメージがプッシュまたは削除されるたびに更新されます。GitLab Self-Managedインスタンスでは、コンテナレジストリメタデータデータベースを有効にする必要があります。
レスポンス例:
{
"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": "main",
"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/main/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/main/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_forward_deployment_rollback_allowed": true,
"ci_allow_fork_pipelines_to_run_in_parent_project": true,
"ci_id_token_sub_claim_components": ["project_path", "ref_type", "ref"],
"ci_separated_caches": true,
"ci_restrict_pipeline_cancellation_role": "developer",
"ci_pipeline_variables_minimum_override_role": "maintainer",
"ci_push_repository_for_job_token_allowed": false,
"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,
"allow_pipeline_trigger_approve_deployment": 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 in favor of marked_for_deletion_on. Planned for removal in a future version of the REST API.
"marked_for_deletion_on": "2020-04-03",
"compliance_frameworks": [ "sox" ],
"warn_about_potentially_unwanted_characters": true,
"secret_push_protection_enabled": false,
"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_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"
},
"spp_repository_pipeline_access": false // Only visible if the security_orchestration_policies feature is available
}GitLab Ultimateのユーザーは、GitLab 15.5以降を使用して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":"main",
"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/main/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
},
"repository_storage": "default"
}
...
}イシューとマージリクエストのテンプレート
- プラン: Premium、Ultimate
- 提供形態: GitLab.com、GitLab Self-Managed、GitLab Dedicated
GitLab PremiumまたはUltimateのユーザーに対しては、イシューおよびマージリクエストの説明テンプレートを管理するためのissues_templateパラメータとmerge_requests_templateパラメータも表示されます。
{
"id": 3,
"issues_template": null,
"merge_requests_template": null,
...
}プロジェクトのリストを取得する
プロジェクトのリストを取得します。
すべてのプロジェクトのリストを取得する
web_based_commit_signing_enabled属性の利用可否は、機能フラグによって制御されます。詳細については、履歴を参照してください。この機能はテストには利用できますが、本番環境での使用には適していません。
認証済みユーザーに対して、GitLab全体の表示可能なすべてのプロジェクトのリストを取得します。認証なしでアクセスすると、単純なフィールドを持つ公開プロジェクトのみが返されます。
GET /projectsサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
archived | ブール値 | いいえ | アーカイブ状態で制限します。 |
id_after | 整数 | いいえ | 指定されたIDより大きいIDを持つプロジェクトに結果を制限します。 |
id_before | 整数 | いいえ | 指定されたIDより小さいIDを持つプロジェクトに結果を制限します。 |
imported | ブール値 | いいえ | 現在のユーザーによって外部システムからインポートされたプロジェクトに結果を制限します。 |
include_hidden | ブール値 | いいえ | 非表示プロジェクトを含めます。_(管理者のみ)_PremiumおよびUltimateのみ。 |
include_pending_delete | ブール値 | いいえ | 削除保留中のプロジェクトを含めます。(管理者のみ) |
last_activity_after | 日時 | いいえ | 指定された時刻以降に最後のアクティビティーが行われたプロジェクトに結果を制限します。形式: ISO 8601(YYYY-MM-DDTHH:MM:SSZ) |
last_activity_before | 日時 | いいえ | 指定された時刻以前に最後のアクティビティーが行われたプロジェクトに結果を制限します。形式: ISO 8601(YYYY-MM-DDTHH:MM:SSZ) |
membership | ブール値 | いいえ | 現在のユーザーがメンバーであるプロジェクトで制限します。 |
min_access_level | 整数 | いいえ | 現在のユーザーの最小ロール(access_level)で制限します。 |
order_by | 文字列 | いいえ | id、name、path、created_at、updated_at、star_count、last_activity_at、またはsimilarityフィールドで並べ替えられたプロジェクトを返します。repository_size、storage_size、packages_size、またはwiki_sizeフィールドは、管理者のみが使用できます。similarityは検索時にのみ使用可能であり、現在のユーザーがメンバーであるプロジェクトに限定されます。デフォルトはcreated_atです。 |
owned | ブール値 | いいえ | 現在のユーザーが明示的に所有するプロジェクトで制限します。 |
repository_checksum_failed | ブール値 | いいえ | リポジトリチェックサムの計算に失敗したプロジェクトを制限します。PremiumおよびUltimateのみです。 |
repository_storage | 文字列 | いいえ | repository_storageに保存されているプロジェクトに結果を制限します。(管理者のみ) |
search_namespaces | ブール値 | いいえ | 検索条件に一致するときに、祖先のネームスペースを含めます。デフォルトはfalseです。 |
search | 文字列 | いいえ | path、name、またはdescriptionが検索条件(大文字と小文字は区別されない、部分文字列一致)に一致するプロジェクトのリストを返します。複数の用語は、エスケープされたスペース(+または%20)で区切って指定できます。これらの用語はANDで結合されます。たとえばone+twoは、部分文字列oneおよびtwo(順不同)に一致します。 |
simple | ブール値 | いいえ | プロジェクトごとに制限されたフィールドのみを返します。認証がない場合、このオペレーションは何も行いません。単純なフィールドのみが返されます。 |
sort | 文字列 | いいえ | ascまたはdescの順にソートされたプロジェクトを返します。デフォルトはdescです。 |
starred | ブール値 | いいえ | 現在のユーザーがお気に入りに登録したプロジェクトで制限します。 |
statistics | ブール値 | いいえ | プロジェクトの統計を含めます。レポーター以上のロールを持つユーザーのみが利用できます。 |
topic_id | 整数 | いいえ | トピックIDで指定された、割り当てられたトピックを含むプロジェクトに結果を制限します。 |
topic | 文字列 | いいえ | カンマ区切りのトピック名。指定されたすべてのトピックに一致するプロジェクトに結果を制限します。topics属性を参照してください。 |
updated_after | 日時 | いいえ | 指定された時刻以降に最終更新が行われたプロジェクトに結果を制限します。形式: ISO 8601(YYYY-MM-DDTHH:MM:SSZ)。GitLab 15.10で導入されました。このフィルターを機能させるには、updated_atをorder_by属性として指定する必要もあります。 |
updated_before | 日時 | いいえ | 指定された時刻以前に最終更新が行われたプロジェクトに結果を制限します。形式: ISO 8601(YYYY-MM-DDTHH:MM:SSZ)。GitLab 15.10で導入されました。このフィルターを機能させるには、updated_atをorder_by属性として指定する必要もあります。 |
visibility | 文字列 | いいえ | 表示レベル(public、internal、private)で制限します。 |
wiki_checksum_failed | ブール値 | いいえ | Wikiチェックサムの計算に失敗したプロジェクトを制限します。PremiumおよびUltimateのみです。 |
with_custom_attributes | ブール値 | いいえ | 応答にカスタム属性を含めます。(管理者のみ) |
with_issues_enabled | ブール値 | いいえ | 有効になっているイシュー機能で制限します。 |
with_merge_requests_enabled | ブール値 | いいえ | 有効になっているマージリクエスト機能で制限します。 |
with_programming_language | 文字列 | いいえ | 指定されているプログラミング言語を使用するプロジェクトで制限します。 |
marked_for_deletion_on | 日付 | いいえ | プロジェクトが削除対象としてマークされた日付でフィルタリングします。GitLab 17.1で導入されました。PremiumおよびUltimateのみです。 |
active | ブール値 | いいえ | アーカイブされておらず、削除対象としてマークされていないプロジェクトで制限します。 |
このエンドポイントは、一部のorder_byオプションでキーセットページネーションをサポートしています。
simple=trueであるか、またはユーザーが認証されていない場合、これは次のような内容を返します:
リクエストの例:
curl --request GET "https://gitlab.example.com/api/v4/projects?simple=true"レスポンス例:
[
{
"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",
"visibility": "public",
"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/main/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, // deprecated, use package_registry_access_level instead
"package_registry_access_level": "enabled",
"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,
"emails_enabled": 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_forward_deployment_rollback_allowed": true,
"ci_allow_fork_pipelines_to_run_in_parent_project": true,
"ci_id_token_sub_claim_components": ["project_path", "ref_type", "ref"],
"ci_job_token_scope_enabled": false,
"ci_separated_caches": true,
"ci_restrict_pipeline_cancellation_role": "developer",
"ci_pipeline_variables_minimum_override_role": "maintainer",
"ci_push_repository_for_job_token_allowed": false,
"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,
"allow_pipeline_trigger_approve_deployment": false,
"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,
"secret_push_protection_enabled": false,
"compliance_frameworks": [],
"warn_about_potentially_unwanted_characters": true,
"permissions": {
"project_access": null,
"group_access": null
}
},
{
...
}
]last_activity_atは、プロジェクトアクティビティーとプロジェクトイベントに基づいて更新されます。updated_atは、プロジェクトレコードがデータベースで変更されるたびに更新されます。
カスタム属性でフィルタリングするには、以下を使用します:
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"ページネーションの制限
オフセットベースのページネーションを使用すると、最大50,000件のプロジェクトにアクセスできます。
この制限を超えるプロジェクトを取得するには、キーセットページネーションを使用します。キーセットページネーションは、order_by=idのみをサポートします。その他のソートオプションは利用できません。
ユーザーのプロジェクトのリストを取得する
指定されたユーザーが所有する、表示可能なプロジェクトのリストを取得します。認証なしでアクセスした場合、公開プロジェクトのみが返されます。
前提要件:
- 特定の属性を表示するには、管理者であるか、プロジェクトのオーナーロールを持っている必要があります。
user_idで指定されたユーザーのネームスペースにあるプロジェクトのみが返されます。グループまたはサブグループ内のユーザーが所有するプロジェクトは返されません。プロファイルが非公開に設定されている場合、空のリストが返されます。
このエンドポイントは、一部のorder_byオプションでキーセットページネーションをサポートしています。
GET /users/:user_id/projectsサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
user_id | 文字列 | はい | ユーザーのIDまたはユーザー名。 |
archived | ブール値 | いいえ | アーカイブ状態で制限します。 |
id_after | 整数 | いいえ | 指定されたIDより大きいIDを持つプロジェクトに結果を制限します。 |
id_before | 整数 | いいえ | 指定されたIDより小さいIDを持つプロジェクトに結果を制限します。 |
membership | ブール値 | いいえ | 現在のユーザーがメンバーであるプロジェクトで制限します。 |
min_access_level | 整数 | いいえ | 現在のユーザーの最小ロール(access_level)で制限します。 |
order_by | 文字列 | いいえ | id、name、path、created_at、updated_at、star_count、またはlast_activity_atのフィールドで並べ替えられたプロジェクトを返します。デフォルトはcreated_atです。 |
owned | ブール値 | いいえ | 現在のユーザーが明示的に所有するプロジェクトで制限します。 |
search | 文字列 | いいえ | 検索条件に一致するプロジェクトのリストを返します。 |
simple | ブール値 | いいえ | プロジェクトごとに制限されたフィールドのみを返します。認証がない場合、このオペレーションは何も行いません。単純なフィールドのみが返されます。 |
sort | 文字列 | いいえ | ascまたはdescの順にソートされたプロジェクトを返します。デフォルトはdescです。 |
starred | ブール値 | いいえ | 現在のユーザーがお気に入りに登録したプロジェクトで制限します。 |
statistics | ブール値 | いいえ | プロジェクトの統計を含めます。レポーター以上のロールを持つユーザーのみが利用できます。 |
updated_after | 日時 | いいえ | 指定された時刻以降に最終更新が行われたプロジェクトに結果を制限します。形式: ISO 8601(YYYY-MM-DDTHH:MM:SSZ)。GitLab 15.10で導入されました。 |
updated_before | 日時 | いいえ | 指定された時刻以前に最終更新が行われたプロジェクトに結果を制限します。形式: ISO 8601(YYYY-MM-DDTHH:MM:SSZ)。GitLab 15.10で導入されました。 |
visibility | 文字列 | いいえ | 表示レベル(public、internal、private)で制限します。 |
with_custom_attributes | ブール値 | いいえ | 応答にカスタム属性を含めます。(管理者のみ) |
with_issues_enabled | ブール値 | いいえ | 有効になっているイシュー機能で制限します。 |
with_merge_requests_enabled | ブール値 | いいえ | 有効になっているマージリクエスト機能で制限します。 |
with_programming_language | 文字列 | いいえ | 指定されているプログラミング言語を使用するプロジェクトで制限します。 |
レスポンス例:
[
{
"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": "main",
"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/main/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_forward_deployment_rollback_allowed": true,
"ci_allow_fork_pipelines_to_run_in_parent_project": true,
"ci_id_token_sub_claim_components": ["project_path", "ref_type", "ref"],
"ci_separated_caches": true,
"ci_restrict_pipeline_cancellation_role": "developer",
"ci_pipeline_variables_minimum_override_role": "maintainer",
"ci_push_repository_for_job_token_allowed": false,
"public_jobs": true,
"shared_with_groups": [],
"only_allow_merge_if_pipeline_succeeds": false,
"allow_merge_on_skipped_pipeline": false,
"allow_pipeline_trigger_approve_deployment": 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,
"secret_push_protection_enabled": false,
"issue_branch_template": "gitlab/%{id}-%{title}",
"marked_for_deletion_at": "2020-04-03", // Deprecated in favor of marked_for_deletion_on. Planned for removal in a future version of the REST API.
"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_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": "main",
"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/main/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_forward_deployment_rollback_allowed": true,
"ci_allow_fork_pipelines_to_run_in_parent_project": true,
"ci_id_token_sub_claim_components": ["project_path", "ref_type", "ref"],
"ci_separated_caches": true,
"ci_restrict_pipeline_cancellation_role": "developer",
"ci_pipeline_variables_minimum_override_role": "maintainer",
"ci_push_repository_for_job_token_allowed": false,
"public_jobs": true,
"shared_with_groups": [],
"only_allow_merge_if_pipeline_succeeds": false,
"allow_merge_on_skipped_pipeline": false,
"allow_pipeline_trigger_approve_deployment": 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, // deprecated, use package_registry_access_level instead
"package_registry_access_level": "enabled",
"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,
"secret_push_protection_enabled": false,
"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_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"
}
}
]ユーザーがコントリビュートしたプロジェクトのリストを取得する
指定されたユーザーが過去1年以内にコントリビュートした、表示可能なプロジェクトのリストを返します。コントリビュートとみなされる内容の詳細については、コントリビュートしたプロジェクトの表示を参照してください。
GET /users/:user_id/contributed_projectsサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
user_id | 文字列 | はい | ユーザーのIDまたはユーザー名。 |
order_by | 文字列 | いいえ | id、name、path、created_at、updated_at、star_count、またはlast_activity_atのフィールドで並べ替えられたプロジェクトを返します。デフォルトはcreated_atです。 |
simple | ブール値 | いいえ | プロジェクトごとに制限されたフィールドのみを返します。認証がない場合、このオペレーションは何も行いません。単純なフィールドのみが返されます。 |
sort | 文字列 | いいえ | ascまたはdescの順にソートされたプロジェクトを返します。デフォルトはdescです。 |
リクエストの例:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "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": "main",
"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/main/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,
"allow_pipeline_trigger_approve_deployment": 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,
"secret_push_protection_enabled": false,
"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_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": "main",
"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/main/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,
"allow_pipeline_trigger_approve_deployment": 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, // deprecated, use package_registry_access_level instead
"package_registry_access_level": "enabled",
"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,
"secret_push_protection_enabled": false,
"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_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 /projects属性の例:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
search | 文字列 | はい | プロジェクト名に含まれる文字列。 |
order_by | 文字列 | いいえ | id、name、created_at、star_count、またはlast_activity_atフィールドで並べ替えられたリクエストを返します。 |
sort | 文字列 | いいえ | ascまたはdescの順にソートされたリクエストを返します。 |
リクエストの例:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects?search=test"属性のリストを取得する
プロジェクトの属性のリストを取得します。
ユーザーのリストを取得する
プロジェクトのユーザーリストを取得します。
GET /projects/:id/usersサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
search | 文字列 | いいえ | 特定のユーザーを検索します。 |
skip_users | 整数の配列 | いいえ | 指定された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 | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
search | 文字列 | いいえ | 特定のグループを検索します。 |
shared_min_access_level | 整数 | いいえ | 少なくともこのロール(access_level)を持つ共有グループに制限します。 |
shared_visible_only | ブール値 | いいえ | ユーザーがアクセスできる共有グループに制限します。 |
skip_groups | 整数の配列 | いいえ | 渡されたグループIDをスキップします。 |
with_shared | ブール値 | いいえ | このグループと共有されているプロジェクトを含めます。デフォルトは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 | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
search | 文字列 | いいえ | 特定のグループを検索します。 |
レスポンス例:
[
{
"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"
}
]プロジェクトに招待されたグループのリストを取得する
プロジェクトに招待されたグループのリストを取得します。認証なしでアクセスすると、公開招待グループのみが返されます。このエンドポイントは、次の項目ごとに1分あたり60件のリクエストにレート制限されています:
- 認証済みユーザーのユーザー。
- 認証されていないユーザーのIPアドレス。
APIの結果はページネーションされるため、デフォルトでは、このリクエストは一度に20個の結果を返します。
GET /projects/:id/invited_groupsサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | グループのIDまたはURLエンコードされたパス |
search | 文字列 | いいえ | 検索条件に一致する認証済みグループのリストを返します |
min_access_level | 整数 | いいえ | 現在のユーザーが、指定されているロール(access_level)以上のロールを持っているグループに制限します。 |
relation | 文字列の配列 | いいえ | グループを関係(直接または継承)でフィルタリングします。 |
with_custom_attributes | ブール値 | いいえ | 応答にカスタム属性を含めます(管理者のみ) |
レスポンス例:
[
{
"id": 35,
"web_url": "https://gitlab.example.com/groups/twitter",
"name": "Twitter",
"avatar_url": null,
"full_name": "Twitter",
"full_path": "twitter"
}
]使用されているプログラミング言語のリストを取得する
プロジェクトで使用されているプログラミング言語のリストと使用率を取得します。
GET /projects/:id/languagesサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
リクエストの例:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/5/languages"レスポンス例:
{
"Ruby": 66.69,
"JavaScript": 22.98,
"HTML": 7.91,
"CoffeeScript": 2.42
}プロジェクトを管理する
プロジェクトを管理します(作成、削除、アーカイブなど)。
プロジェクトを作成する
認証済みユーザーが所有する新しいプロジェクトを作成します。
HTTPリポジトリが公開されていない場合は、URL https://username:password@gitlab.company.com/group/project.gitに認証情報を追加します。ここで、passwordはapiスコープが有効な公開アクセスキーです。
POST /projectsサポートされている一般的なプロジェクトの属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
name | 文字列 | はい(pathが指定されていない場合) | 新しいプロジェクトの名前。指定されていない場合はパスと等しくなります。 |
path | 文字列 | はい(nameが指定されていない場合) | 新しいプロジェクトのリポジトリ名。指定されていない場合は、名前に基づいて生成されます(小文字とダッシュを使用して生成)。パスの先頭と末尾には特殊文字を使用できません。また、連続する特殊文字を含めることはできません。 |
allow_merge_on_skipped_pipeline | ブール値 | いいえ | スキップされたジョブでマージリクエストをマージできるかどうかを設定します。 |
approvals_before_merge | 整数 | いいえ | デフォルトでマージリクエストを承認する必要がある承認者の数。承認ルールを設定するには、マージリクエスト承認APIを参照してください。GitLab 16.0で非推奨になりました。PremiumおよびUltimateのみです。 |
auto_cancel_pending_pipelines | 文字列 | いいえ | 保留中のパイプラインを自動的にキャンセルします。このアクションは、有効状態と無効状態を切り替えます。ブール値ではありません。 |
auto_devops_deploy_strategy | 文字列 | いいえ | 自動デプロイ戦略(continuous、manual、またはtimed_incremental)。 |
auto_devops_enabled | ブール値 | いいえ | このプロジェクトに対してAuto DevOpsを有効にします。 |
autoclose_referenced_issues | ブール値 | いいえ | デフォルトブランチで参照されているイシューを自動的にクローズするかどうかを設定します。 |
avatar | 混合 | いいえ | プロジェクトのアバターの画像ファイル。 |
build_git_strategy | 文字列 | いいえ | Git戦略。fetchがデフォルトです。 |
build_timeout | 整数 | いいえ | ジョブの最大実行可能時間(秒単位)。 |
ci_config_path | 文字列 | いいえ | CI設定ファイルへのパス。 |
container_expiration_policy_attributes | ハッシュ | いいえ | このプロジェクト用のイメージのクリーンアップポリシーを更新します。cadence(文字列)、keep_n(整数)、older_than(文字列)、name_regex(文字列)、name_regex_delete(文字列)、name_regex_keep(文字列)、enabled(ブール値)を指定できます。cadence、keep_n、older_thanの値の詳細については、コンテナレジストリのドキュメントを参照してください。 |
container_registry_enabled | ブール値 | いいえ | _(非推奨)_このプロジェクトのコンテナレジストリを有効にします。代わりにcontainer_registry_access_levelを使用してください。 |
default_branch | 文字列 | いいえ | デフォルトブランチ名。initialize_with_readmeがtrueである必要があります。 |
description | 文字列 | いいえ | プロジェクトの短い説明。 |
emails_disabled | ブール値 | いいえ | _(非推奨)_メール通知を無効にします。代わりにemails_enabledを使用してください。 |
emails_enabled | ブール値 | いいえ | メール通知を有効にします。 |
external_authorization_classification_label | 文字列 | いいえ | プロジェクトの分類ラベル。PremiumおよびUltimateのみです。 |
group_runners_enabled | ブール値 | いいえ | このプロジェクトのグループRunnerを有効にします。 |
group_with_project_templates_id | 整数 | いいえ | グループレベルのカスタムテンプレートの場合、すべてのカスタムプロジェクトテンプレートのソースとなるグループのIDを指定します。インスタンスレベルのテンプレートの場合は空のままにします。use_custom_templateがtrueである必要があります。PremiumおよびUltimateのみです。 |
import_url | 文字列 | いいえ | リポジトリのインポート元のURL。URLの値が空でない場合は、initialize_with_readmeをtrueに設定しないでください。エラー(not a git repository)が発生する可能性があります。 |
initialize_with_readme | ブール値 | いいえ | README.mdファイルのみを使用してGitリポジトリを作成するかどうか。デフォルトはfalseです。このブール値がtrueの場合、import_url、またはリポジトリの代替コンテンツを指定するこのエンドポイントの他の属性を渡してはなりません。エラー(not a git repository)が発生する可能性があります。 |
issues_enabled | ブール値 | いいえ | _(非推奨)_このプロジェクト用にイシューを有効にします。代わりにissues_access_levelを使用してください。 |
jobs_enabled | ブール値 | いいえ | _(非推奨)_このプロジェクト用にジョブを有効にします。代わりにbuilds_access_levelを使用してください。 |
lfs_enabled | ブール値 | いいえ | LFSを有効にします。 |
merge_method | 文字列 | いいえ | プロジェクトのマージ方法を設定します。merge(マージコミット)、rebase_merge(半線形履歴を使用するマージコミット)、またはff(早送りマージ)を指定できます。 |
merge_pipelines_enabled | ブール値 | いいえ | マージ結果パイプラインを有効または無効にします。 |
merge_requests_enabled | ブール値 | いいえ | _(非推奨)_このプロジェクト用にマージリクエストを有効にします。代わりにmerge_requests_access_levelを使用してください。 |
merge_trains_enabled | ブール値 | いいえ | マージトレインを有効または無効にします。 |
merge_trains_skip_train_allowed | ブール値 | いいえ | パイプラインが完了するのを待たずに、マージトレインマージリクエストをマージできるようにします。 |
mirror_trigger_builds | ブール値 | いいえ | プルミラーリングがビルドをトリガーします。PremiumおよびUltimateのみです。 |
mirror | ブール値 | いいえ | プロジェクトでプルミラーリングを有効にします。PremiumおよびUltimateのみです。 |
namespace_id | 整数 | いいえ | 新しいプロジェクトのネームスペース。グループIDまたはサブグループIDを指定します。指定しない場合、デフォルトで現在のユーザーのパーソナルネームスペースが使用されます。 |
only_allow_merge_if_all_discussions_are_resolved | ブール値 | いいえ | すべてのディスカッションが解決された場合にのみマージリクエストをマージできるようにするかどうかを設定します。 |
only_allow_merge_if_all_status_checks_passed | ブール値 | いいえ | すべてのステータスチェックに合格していなければ、マージリクエストのマージをブロックする必要があることを示します。デフォルトはfalseです。機能フラグonly_allow_merge_if_all_status_checks_passedをデフォルトで無効にして、GitLab 15.5で導入されました。Ultimateのみです。 |
only_allow_merge_if_pipeline_succeeds | ブール値 | いいえ | マージリクエストを成功したパイプラインでのみマージできるようにするかどうかを設定します。この設定は、プロジェクト設定でパイプラインが完了しているという名前になります。 |
packages_enabled | ブール値 | いいえ | GitLab 17.10で非推奨になりました。パッケージリポジトリ機能を有効または無効にします。代わりにpackage_registry_access_levelを使用してください。 |
package_registry_access_level | 文字列 | いいえ | パッケージリポジトリ機能を有効または無効にします。 |
printing_merge_request_link_enabled | ブール値 | いいえ | コマンドラインからプッシュするときに、マージリクエストを作成/表示するためのリンクを表示します。 |
public_builds | ブール値 | いいえ | (非推奨)trueの場合、プロジェクトメンバー以外のユーザーもジョブを表示できます。代わりにpublic_jobsを使用してください。 |
public_jobs | ブール値 | いいえ | trueの場合、プロジェクトメンバー以外のユーザーもジョブを表示できます。 |
repository_object_format | 文字列 | いいえ | リポジトリオブジェクト形式。sha1がデフォルトです。GitLab 16.9で導入されました。 |
remove_source_branch_after_merge | ブール値 | いいえ | すべての新しいマージリクエストに対して、デフォルトでDelete source branchオプションを有効にします。 |
repository_storage | 文字列 | いいえ | リポジトリが存在するストレージシャード。(管理者のみ) |
request_access_enabled | ブール値 | いいえ | ユーザーがメンバーアクセスをリクエストできるようにします。 |
resolve_outdated_diff_discussions | ブール値 | いいえ | プッシュで変更された行に関するマージリクエスト差分ディスカッションを自動的に解決します。 |
shared_runners_enabled | ブール値 | いいえ | このプロジェクト用にインスタンスRunnerを有効にします。 |
show_default_award_emojis | ブール値 | いいえ | デフォルトの絵文字リアクションを表示します。 |
snippets_enabled | ブール値 | いいえ | _(非推奨)_このプロジェクト用にスニペットを有効にします。代わりにsnippets_access_levelを使用してください。 |
squash_option | 文字列 | いいえ | never、always、default_on、default_offのいずれかです。 |
tag_list | 配列 | いいえ | プロジェクトのタグのリスト。最終的にプロジェクトに割り当てる必要のあるタグの配列を指定します。GitLab 14.0で非推奨になりました。代わりにtopicsを使用してください。 |
template_name | 文字列 | いいえ | use_custom_templateを指定せずに使用する場合は、組み込みプロジェクトテンプレートの名前。use_custom_templateとともに使用する場合は、カスタムプロジェクトテンプレートの名前。 |
template_project_id | 整数 | いいえ | use_custom_templateとともに使用する場合は、カスタムプロジェクトテンプレートのプロジェクトID。プロジェクトIDを使用する方法は、template_nameを使用する方法よりも推奨されます。これは、template_nameはあいまいになる可能性があるためです。PremiumおよびUltimateのみです。 |
topics | 配列 | いいえ | プロジェクトのトピックのリスト。最終的にプロジェクトに割り当てる必要のあるトピックの配列を指定します。 |
use_custom_template | ブール値 | いいえ | カスタムインスタンスプロジェクトテンプレートまたはグループ(group_with_project_templates_id付き)プロジェクトテンプレートのいずれかを使用します。PremiumおよびUltimateのみです。 |
visibility | 文字列 | いいえ | プロジェクトの表示レベルを参照してください。 |
warn_about_potentially_unwanted_characters | ブール値 | いいえ | このプロジェクトで不要である可能性がある文字の使用に関する警告を有効にします。 |
wiki_enabled | ブール値 | いいえ | _(非推奨)_このプロジェクト用にWikiを有効にします。代わりにwiki_access_levelを使用してください。 |
アクセス制御オプションを使用したプロジェクト機能の表示レベル設定は、次のいずれかにできます:
disabled: 機能を無効にします。private: 機能を有効にして、Only project members(プロジェクトメンバーのみ)に設定します。enabled: 機能を有効にして、Everyone with access(アクセスできる人すべて)に設定します。public: 機能を有効にして、全員に設定します。pages_access_levelでのみ利用可能です。
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
analytics_access_level | 文字列 | いいえ | 分析の表示レベルを設定します。 |
builds_access_level | 文字列 | いいえ | パイプラインの表示レベルを設定します。 |
container_registry_access_level | 文字列 | いいえ | コンテナレジストリの表示レベルを設定します。 |
environments_access_level | 文字列 | いいえ | 環境の表示レベルを設定します。 |
feature_flags_access_level | 文字列 | いいえ | 機能フラグの表示レベルを設定します。 |
forking_access_level | 文字列 | いいえ | フォークの表示レベルを設定します。 |
infrastructure_access_level | 文字列 | いいえ | インフラストラクチャ管理の表示レベルを設定します。 |
issues_access_level | 文字列 | いいえ | イシューの表示レベルを設定します。 |
merge_requests_access_level | 文字列 | いいえ | マージリクエストの表示レベルを設定します。 |
model_experiments_access_level | 文字列 | いいえ | 機械学習モデル検証の表示レベルを設定します。 |
model_registry_access_level | 文字列 | いいえ | 機械学習モデルレジストリの表示レベルを設定します。 |
monitor_access_level | 文字列 | いいえ | アプリケーションパフォーマンスモニタリングの表示レベルを設定します。 |
pages_access_level | 文字列 | いいえ | GitLab Pagesの表示レベルを設定します。 |
releases_access_level | 文字列 | いいえ | リリースの表示レベルを設定します。 |
repository_access_level | 文字列 | いいえ | リポジトリの表示レベルを設定します。 |
requirements_access_level | 文字列 | いいえ | 要件管理の表示レベルを設定します。 |
security_and_compliance_access_level | 文字列 | いいえ | セキュリティとコンプライアンスの表示レベルを設定します。 |
snippets_access_level | 文字列 | いいえ | スニペットの表示レベルを設定します。 |
wiki_access_level | 文字列 | いいえ | Wikiの表示レベルを設定します。 |
リクエストの例:
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/"ユーザーのプロジェクトを作成する
ユーザーのプロジェクトを作成します。
前提要件:
- 管理者である必要があります。
HTTPリポジトリが公開されていない場合は、認証情報をURLに追加します。たとえばhttps://username:password@gitlab.company.com/group/project.gitの場合、passwordは、apiスコープが有効になっているパブリックアクセスキーです。
POST /projects/user/:user_idサポートされている一般的なプロジェクトの属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
name | 文字列 | はい | 新しいプロジェクトの名前。 |
user_id | 整数 | はい | プロジェクトオーナーのユーザーID。 |
allow_merge_on_skipped_pipeline | ブール値 | いいえ | スキップされたジョブでマージリクエストをマージできるかどうかを設定します。 |
approvals_before_merge | 整数 | いいえ | デフォルトでマージリクエストを承認する必要がある承認者の数。GitLab 16.0で非推奨になりました。承認ルールを設定するには、マージリクエスト承認APIを参照してください。PremiumおよびUltimateのみです。 |
auto_cancel_pending_pipelines | 文字列 | いいえ | 保留中のパイプラインを自動的にキャンセルします。このアクションは、有効状態と無効状態を切り替えます。ブール値ではありません。 |
auto_devops_deploy_strategy | 文字列 | いいえ | 自動デプロイ戦略(continuous、manual、またはtimed_incremental)。 |
auto_devops_enabled | ブール値 | いいえ | このプロジェクトに対してAuto DevOpsを有効にします。 |
autoclose_referenced_issues | ブール値 | いいえ | デフォルトブランチで参照されているイシューを自動的にクローズするかどうかを設定します。 |
avatar | 混合 | いいえ | プロジェクトのアバターの画像ファイル。 |
build_git_strategy | 文字列 | いいえ | Git戦略。fetchがデフォルトです。 |
build_timeout | 整数 | いいえ | ジョブの最大実行可能時間(秒単位)。 |
ci_config_path | 文字列 | いいえ | CI設定ファイルへのパス。 |
container_registry_enabled | ブール値 | いいえ | _(非推奨)_このプロジェクトのコンテナレジストリを有効にします。代わりにcontainer_registry_access_levelを使用してください。 |
default_branch | 文字列 | いいえ | デフォルトブランチ名。initialize_with_readmeがtrueである必要があります。 |
description | 文字列 | いいえ | プロジェクトの短い説明。 |
emails_disabled | ブール値 | いいえ | _(非推奨)_メール通知を無効にします。代わりにemails_enabledを使用してください。 |
emails_enabled | ブール値 | いいえ | メール通知を有効にします。 |
enforce_auth_checks_on_uploads | ブール値 | いいえ | アップロード時に認証チェックを強制します。 |
external_authorization_classification_label | 文字列 | いいえ | プロジェクトの分類ラベル。PremiumおよびUltimateのみです。 |
group_runners_enabled | ブール値 | いいえ | このプロジェクトのグループRunnerを有効にします。 |
group_with_project_templates_id | 整数 | いいえ | グループレベルのカスタムテンプレートの場合、すべてのカスタムプロジェクトテンプレートのソースとなるグループのIDを指定します。インスタンスレベルのテンプレートの場合は空のままにします。use_custom_templateがtrueである必要があります。PremiumおよびUltimateのみです。 |
import_url | 文字列 | いいえ | リポジトリのインポート元のURL。 |
initialize_with_readme | ブール値 | いいえ | デフォルトではfalseです。 |
issue_branch_template | 文字列 | いいえ | イシューから作成されたブランチの名前を提案するために使用されるテンプレート。(GitLab 15.6で導入されました) |
issues_enabled | ブール値 | いいえ | _(非推奨)_このプロジェクト用にイシューを有効にします。代わりにissues_access_levelを使用してください。 |
jobs_enabled | ブール値 | いいえ | _(非推奨)_このプロジェクト用にジョブを有効にします。代わりにbuilds_access_levelを使用してください。 |
lfs_enabled | ブール値 | いいえ | LFSを有効にします。 |
merge_commit_template | 文字列 | いいえ | マージリクエストでマージコミットメッセージを作成するために使用されるテンプレート。 |
merge_method | 文字列 | いいえ | プロジェクトのマージ方法を設定します。merge(マージコミット)、rebase_merge(半線形履歴を使用するマージコミット)、またはff(早送りマージ)を指定できます。 |
merge_requests_enabled | ブール値 | いいえ | _(非推奨)_このプロジェクト用にマージリクエストを有効にします。代わりにmerge_requests_access_levelを使用してください。 |
mirror_trigger_builds | ブール値 | いいえ | プルミラーリングがビルドをトリガーします。PremiumおよびUltimateのみです。 |
mirror | ブール値 | いいえ | プロジェクトでプルミラーリングを有効にします。PremiumおよびUltimateのみです。 |
namespace_id | 整数 | いいえ | 新しいプロジェクトのネームスペース(デフォルトは現在のユーザーのネームスペース)。 |
only_allow_merge_if_all_discussions_are_resolved | ブール値 | いいえ | すべてのディスカッションが解決された場合にのみマージリクエストをマージできるようにするかどうかを設定します。 |
only_allow_merge_if_all_status_checks_passed | ブール値 | いいえ | すべてのステータスチェックに合格していなければ、マージリクエストのマージをブロックする必要があることを示します。デフォルトはfalseです。機能フラグonly_allow_merge_if_all_status_checks_passedをデフォルトで無効にして、GitLab 15.5で導入されました。Ultimateのみです。 |
only_allow_merge_if_pipeline_succeeds | ブール値 | いいえ | マージリクエストを成功したジョブのみとマージできるようにするかどうかを設定します。 |
packages_enabled | ブール値 | いいえ | GitLab 17.10で非推奨になりました。パッケージリポジトリ機能を有効または無効にします。代わりにpackage_registry_access_levelを使用してください。 |
package_registry_access_level | 文字列 | いいえ | パッケージリポジトリ機能を有効または無効にします。 |
path | 文字列 | いいえ | 新しいプロジェクトのカスタムリポジトリ名。デフォルトでは、名前に基づいて生成されます。 |
printing_merge_request_link_enabled | ブール値 | いいえ | コマンドラインからプッシュするときに、マージリクエストを作成/表示するためのリンクを表示します。 |
public_builds | ブール値 | いいえ | (非推奨)trueの場合、プロジェクトメンバー以外のユーザーもジョブを表示できます。代わりにpublic_jobsを使用してください。 |
public_jobs | ブール値 | いいえ | trueの場合、プロジェクトメンバー以外のユーザーもジョブを表示できます。 |
repository_object_format | 文字列 | いいえ | リポジトリオブジェクト形式。sha1がデフォルトです。GitLab 16.9で導入されました。 |
remove_source_branch_after_merge | ブール値 | いいえ | すべての新しいマージリクエストに対して、デフォルトでDelete source branchオプションを有効にします。 |
repository_storage | 文字列 | いいえ | リポジトリが存在するストレージシャード。(管理者のみ) |
request_access_enabled | ブール値 | いいえ | ユーザーがメンバーアクセスをリクエストできるようにします。 |
resolve_outdated_diff_discussions | ブール値 | いいえ | プッシュで変更された行に関するマージリクエスト差分ディスカッションを自動的に解決します。 |
shared_runners_enabled | ブール値 | いいえ | このプロジェクト用にインスタンスRunnerを有効にします。 |
show_default_award_emojis | ブール値 | いいえ | デフォルトの絵文字リアクションを表示します。 |
snippets_enabled | ブール値 | いいえ | _(非推奨)_このプロジェクト用にスニペットを有効にします。代わりにsnippets_access_levelを使用してください。 |
squash_commit_template | 文字列 | いいえ | マージリクエストでスカッシュコミットメッセージを作成するために使用されるテンプレート。 |
squash_option | 文字列 | いいえ | never、always、default_on、default_offのいずれかです。 |
suggestion_commit_message | 文字列 | いいえ | マージリクエストの提案を適用するために使用されるコミットメッセージ。 |
tag_list | 配列 | いいえ | _(GitLab 14.0で非推奨になりました)_プロジェクトのタグのリスト。最終的にプロジェクトに割り当てる必要があるタグの配列を指定します。代わりにtopicsを使用してください。 |
template_name | 文字列 | いいえ | use_custom_templateを指定せずに使用する場合は、組み込みプロジェクトテンプレートの名前。use_custom_templateとともに使用する場合は、カスタムプロジェクトテンプレートの名前。 |
topics | 配列 | いいえ | プロジェクトのトピックのリスト。 |
use_custom_template | ブール値 | いいえ | カスタムインスタンスプロジェクトテンプレートまたはグループ(group_with_project_templates_id付き)プロジェクトテンプレートのいずれかを使用します。PremiumおよびUltimateのみです。 |
visibility | 文字列 | いいえ | プロジェクトの表示レベルを参照してください。 |
warn_about_potentially_unwanted_characters | ブール値 | いいえ | このプロジェクトで不要である可能性がある文字の使用に関する警告を有効にします。 |
wiki_enabled | ブール値 | いいえ | _(非推奨)_このプロジェクト用にWikiを有効にします。代わりにwiki_access_levelを使用してください。 |
アクセス制御オプションを使用したプロジェクト機能の表示レベル設定は、次のいずれかにできます:
disabled: 機能を無効にします。private: 機能を有効にして、Only project members(プロジェクトメンバーのみ)に設定します。enabled: 機能を有効にして、Everyone with access(アクセスできる人すべて)に設定します。public: 機能を有効にして、全員に設定します。pages_access_levelでのみ利用可能です。
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
analytics_access_level | 文字列 | いいえ | 分析の表示レベルを設定します。 |
builds_access_level | 文字列 | いいえ | パイプラインの表示レベルを設定します。 |
container_registry_access_level | 文字列 | いいえ | コンテナレジストリの表示レベルを設定します。 |
environments_access_level | 文字列 | いいえ | 環境の表示レベルを設定します。 |
feature_flags_access_level | 文字列 | いいえ | 機能フラグの表示レベルを設定します。 |
forking_access_level | 文字列 | いいえ | フォークの表示レベルを設定します。 |
infrastructure_access_level | 文字列 | いいえ | インフラストラクチャ管理の表示レベルを設定します。 |
issues_access_level | 文字列 | いいえ | イシューの表示レベルを設定します。 |
merge_requests_access_level | 文字列 | いいえ | マージリクエストの表示レベルを設定します。 |
model_experiments_access_level | 文字列 | いいえ | 機械学習モデル検証の表示レベルを設定します。 |
model_registry_access_level | 文字列 | いいえ | 機械学習モデルレジストリの表示レベルを設定します。 |
monitor_access_level | 文字列 | いいえ | アプリケーションパフォーマンスモニタリングの表示レベルを設定します。 |
pages_access_level | 文字列 | いいえ | GitLab Pagesの表示レベルを設定します。 |
releases_access_level | 文字列 | いいえ | リリースの表示レベルを設定します。 |
repository_access_level | 文字列 | いいえ | リポジトリの表示レベルを設定します。 |
requirements_access_level | 文字列 | いいえ | 要件管理の表示レベルを設定します。 |
security_and_compliance_access_level | 文字列 | いいえ | セキュリティとコンプライアンスの表示レベルを設定します。 |
snippets_access_level | 文字列 | いいえ | スニペットの表示レベルを設定します。 |
wiki_access_level | 文字列 | いいえ | Wikiの表示レベルを設定します。 |
プロジェクトを編集する
既存のプロジェクトを更新します。
HTTPリポジトリが公開されていない場合は、URL https://username:password@gitlab.company.com/group/project.gitに認証情報を追加します。ここで、passwordはapiスコープが有効な公開アクセスキーです。
PUT /projects/:idサポートされている一般的なプロジェクトの属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
allow_merge_on_skipped_pipeline | ブール値 | いいえ | スキップされたジョブでマージリクエストをマージできるかどうかを設定します。 |
allow_pipeline_trigger_approve_deployment | ブール値 | いいえ | パイプラインのトリガー元がデプロイを承認できるかどうかを設定します。PremiumおよびUltimateのみです。 |
only_allow_merge_if_all_status_checks_passed | ブール値 | いいえ | すべてのステータスチェックに合格していなければ、マージリクエストのマージをブロックする必要があることを示します。デフォルトはfalseです。 機能フラグ only_allow_merge_if_all_status_checks_passedをデフォルトで無効にして、GitLab 15.5で導入されました。この機能フラグは、GitLab 15.9でデフォルトで有効になりました。Ultimateのみです。 |
approvals_before_merge | 整数 | いいえ | デフォルトでマージリクエストを承認する必要がある承認者の数。GitLab 16.0で非推奨になりました。承認ルールを設定するには、マージリクエスト承認APIを参照してください。PremiumおよびUltimateのみです。 |
auto_cancel_pending_pipelines | 文字列 | いいえ | 保留中のパイプラインを自動的にキャンセルします。このアクションは、有効状態と無効状態を切り替えます。ブール値ではありません。 |
auto_devops_deploy_strategy | 文字列 | いいえ | 自動デプロイ戦略(continuous、manual、またはtimed_incremental)。 |
auto_devops_enabled | ブール値 | いいえ | このプロジェクトに対してAuto DevOpsを有効にします。 |
auto_duo_code_review_enabled | ブール値 | いいえ | マージリクエストでGitLab Duoによる自動レビューを有効にします。マージリクエストのGitLab Duoしてください。Ultimateのみです。 |
autoclose_referenced_issues | ブール値 | いいえ | デフォルトブランチで参照されているイシューを自動的にクローズするかどうかを設定します。 |
avatar | 混合 | いいえ | プロジェクトのアバターの画像ファイル。 |
build_git_strategy | 文字列 | いいえ | Git戦略。fetchがデフォルトです。 |
build_timeout | 整数 | いいえ | ジョブの最大実行可能時間(秒単位)。 |
ci_config_path | 文字列 | いいえ | CI設定ファイルへのパス。 |
ci_default_git_depth | 整数 | いいえ | シャロークローンのリビジョンのデフォルト数。 |
ci_delete_pipelines_in_seconds | 整数 | いいえ | 設定された時刻よりも前のパイプラインは削除されます。 |
ci_forward_deployment_enabled | ブール値 | いいえ | 古いデプロイジョブを防止を有効または無効にします。 |
ci_forward_deployment_rollback_allowed | ブール値 | いいえ | ロールバックデプロイのジョブの再試行を許可するを有効または無効にします。 |
ci_allow_fork_pipelines_to_run_in_parent_project | ブール値 | いいえ | フォークからのマージリクエストに対して親プロジェクトでパイプラインを実行するを有効または無効にします。(GitLab 15.3で導入されました) |
ci_id_token_sub_claim_components | 配列 | いいえ | IDトークンのsubクレームに含まれるフィールド。project_pathで始まる配列を指定できます。配列にはref_typeとrefも含まれる場合があります。["project_path", "ref_type", "ref"]がデフォルトです。GitLab 17.10で導入されました。 |
ci_separated_caches | ブール値 | いいえ | キャッシュをブランチの保護状態に応じて分離するかどうかを設定します。 |
ci_restrict_pipeline_cancellation_role | 文字列 | いいえ | パイプラインまたはジョブをキャンセルするために必要なロールを設定します。developer、maintainer、no_oneのいずれかです。GitLab 16.8で導入されました。PremiumおよびUltimateのみです。 |
ci_pipeline_variables_minimum_override_role | 文字列 | いいえ | 変数をオーバーライドできるロールを指定できます。owner、maintainer、developer、no_one_allowedのいずれかです。GitLab 17.1で導入されました。GitLab 17.1~17.7では、restrict_user_defined_variablesを有効にする必要があります。 |
ci_push_repository_for_job_token_allowed | ブール値 | いいえ | ジョブトークンを使用してプロジェクトリポジトリにプロジェクトをプッシュする機能を有効または無効にします。GitLab 17.2で導入されました。 |
container_expiration_policy_attributes | ハッシュ | いいえ | このプロジェクト用のイメージのクリーンアップポリシーを更新します。cadence(文字列)、keep_n(整数)、older_than(文字列)、name_regex(文字列)、name_regex_delete(文字列)、name_regex_keep(文字列)、enabled(ブール値)を指定できます。 |
container_registry_enabled | ブール値 | いいえ | _(非推奨)_このプロジェクトのコンテナレジストリを有効にします。代わりにcontainer_registry_access_levelを使用してください。 |
default_branch | 文字列 | いいえ | デフォルトブランチ名。 |
description | 文字列 | いいえ | プロジェクトの短い説明。 |
duo_remote_flows_enabled | ブール値 | いいえ | プロジェクトでフローを実行できるかどうかを決定します。 |
emails_disabled | ブール値 | いいえ | _(非推奨)_メール通知を無効にします。代わりにemails_enabledを使用してください。 |
emails_enabled | ブール値 | いいえ | メール通知を有効にします。 |
enforce_auth_checks_on_uploads | ブール値 | いいえ | アップロード時に認証チェックを強制します。 |
external_authorization_classification_label | 文字列 | いいえ | プロジェクトの分類ラベル。PremiumおよびUltimateのみです。 |
group_runners_enabled | ブール値 | いいえ | このプロジェクトのグループRunnerを有効にします。 |
import_url | 文字列 | いいえ | リポジトリのインポート元URL。 |
issues_enabled | ブール値 | いいえ | _(非推奨)_このプロジェクト用にイシューを有効にします。代わりにissues_access_levelを使用してください。 |
issues_template | 文字列 | いいえ | イシューのデフォルトの説明。説明は、GitLab Flavored Markdownを使用して解析されます。イシューとマージリクエストのテンプレートを参照してください。PremiumおよびUltimateのみです。 |
jobs_enabled | ブール値 | いいえ | _(非推奨)_このプロジェクト用にジョブを有効にします。代わりにbuilds_access_levelを使用してください。 |
keep_latest_artifact | ブール値 | いいえ | このプロジェクトの最新のアーティファクトを保持する機能を無効または有効にします。 |
lfs_enabled | ブール値 | いいえ | LFSを有効にします。 |
max_artifacts_size | 整数 | いいえ | 個々のジョブアーティファクトの最大ファイルサイズ(MB単位)。 |
merge_commit_template | 文字列 | いいえ | マージリクエストでマージコミットメッセージを作成するために使用されるテンプレート。 |
merge_method | 文字列 | いいえ | プロジェクトのマージ方法を設定します。merge(マージコミット)、rebase_merge(半線形履歴を使用するマージコミット)、またはff(早送りマージ)を指定できます。 |
merge_pipelines_enabled | ブール値 | いいえ | マージ結果パイプラインを有効または無効にします。 |
merge_requests_enabled | ブール値 | いいえ | _(非推奨)_このプロジェクト用にマージリクエストを有効にします。代わりにmerge_requests_access_levelを使用してください。 |
merge_trains_enabled | ブール値 | いいえ | マージトレインを有効または無効にします。 |
merge_trains_skip_train_allowed | ブール値 | いいえ | パイプラインが完了するのを待たずに、マージトレインマージリクエストをマージできるようにします。 |
mirror_overwrites_diverged_branches | ブール値 | いいえ | プルミラーが、分岐したブランチを上書きします。PremiumおよびUltimateのみです。 |
mirror_trigger_builds | ブール値 | いいえ | プルミラーリングがビルドをトリガーします。PremiumおよびUltimateのみです。 |
mirror_user_id | 整数 | いいえ | プルミラーイベントに関連するすべてのアクティビティーを担当するユーザー。_(管理者のみ)_PremiumとUltimateプランのみ。 |
mirror | ブール値 | いいえ | プロジェクトでプルミラーリングを有効にします。PremiumおよびUltimateのみです。 |
mr_default_target_self | ブール値 | いいえ | フォークされたプロジェクトの場合、マージリクエストのターゲットをこのプロジェクトに設定します。falseの場合、ターゲットはアップストリームプロジェクトになります。 |
name | 文字列 | いいえ | プロジェクト名。 |
only_allow_merge_if_all_discussions_are_resolved | ブール値 | いいえ | すべてのディスカッションが解決された場合にのみマージリクエストをマージできるようにするかどうかを設定します。 |
only_allow_merge_if_pipeline_succeeds | ブール値 | いいえ | マージリクエストを成功したジョブのみとマージできるようにするかどうかを設定します。 |
only_mirror_protected_branches | ブール値 | いいえ | 保護ブランチのみをミラーリングします。PremiumおよびUltimateのみです。 |
packages_enabled | ブール値 | いいえ | GitLab 17.10で非推奨になりました。パッケージリポジトリ機能を有効または無効にします。代わりにpackage_registry_access_levelを使用してください。 |
package_registry_access_level | 文字列 | いいえ | パッケージリポジトリ機能を有効または無効にします。 |
path | 文字列 | いいえ | プロジェクトのカスタムリポジトリ名。デフォルトでは、名前に基づいて生成されます。 |
prevent_merge_without_jira_issue | ブール値 | いいえ | マージリクエストで、Jiraからの関連イシューを必須にするかどうかを設定します。Ultimateのみです。 |
printing_merge_request_link_enabled | ブール値 | いいえ | コマンドラインからプッシュするときに、マージリクエストを作成/表示するためのリンクを表示します。 |
public_builds | ブール値 | いいえ | (非推奨)trueの場合、プロジェクトメンバー以外のユーザーもジョブを表示できます。代わりにpublic_jobsを使用してください。 |
public_jobs | ブール値 | いいえ | trueの場合、プロジェクトメンバー以外のユーザーもジョブを表示できます。 |
remove_source_branch_after_merge | ブール値 | いいえ | すべての新しいマージリクエストに対して、デフォルトでDelete source branchオプションを有効にします。 |
repository_storage | 文字列 | いいえ | リポジトリが存在するストレージシャード。(管理者のみ) |
request_access_enabled | ブール値 | いいえ | ユーザーがメンバーアクセスをリクエストできるようにします。 |
resolve_outdated_diff_discussions | ブール値 | いいえ | プッシュで変更された行に関するマージリクエスト差分ディスカッションを自動的に解決します。 |
restrict_user_defined_variables | ブール値 | いいえ | _(GitLab 17.7で非推奨となり、ci_pipeline_variables_minimum_override_roleが推奨されます)_パイプラインをトリガーするときに、メンテナーロールを持つユーザーのみがユーザー定義変数を渡せるようにします。たとえば、UIで、APIを使用して、またはトリガートークンにより、パイプラインがトリガーされる場合などです。 |
service_desk_enabled | ブール値 | いいえ | サービスデスク機能を有効または無効にします。 |
shared_runners_enabled | ブール値 | いいえ | このプロジェクト用にインスタンスRunnerを有効にします。 |
show_default_award_emojis | ブール値 | いいえ | デフォルトの絵文字リアクションを表示します。 |
snippets_enabled | ブール値 | いいえ | _(非推奨)_このプロジェクト用にスニペットを有効にします。代わりにsnippets_access_levelを使用してください。 |
issue_branch_template | 文字列 | いいえ | イシューから作成されたブランチの名前を提案するために使用されるテンプレート。(GitLab 15.6で導入されました) |
spp_repository_pipeline_access | ブール値 | いいえ | ユーザーとトークンに、このプロジェクトからセキュリティポリシーの設定をフェッチするための読み取り専用アクセスを許可します。このプロジェクトをセキュリティポリシーソースとして使用するプロジェクトで、セキュリティポリシーを適用するために必要です。Ultimateのみです。 |
squash_commit_template | 文字列 | いいえ | マージリクエストでスカッシュコミットメッセージを作成するために使用されるテンプレート。 |
squash_option | 文字列 | いいえ | never、always、default_on、default_offのいずれかです。 |
suggestion_commit_message | 文字列 | いいえ | マージリクエストの提案を適用するために使用されるコミットメッセージ。 |
tag_list | 配列 | いいえ | _(GitLab 14.0で非推奨になりました)_プロジェクトのタグのリスト。最終的にプロジェクトに割り当てる必要があるタグの配列を指定します。代わりにtopicsを使用してください。 |
topics | 配列 | いいえ | プロジェクトのトピックのリスト。これにより、プロジェクトにすでに追加されている既存のトピックがすべて置き換えられます。 |
visibility | 文字列 | いいえ | プロジェクトの表示レベルを参照してください。 |
warn_about_potentially_unwanted_characters | ブール値 | いいえ | このプロジェクトで不要である可能性がある文字の使用に関する警告を有効にします。 |
wiki_enabled | ブール値 | いいえ | _(非推奨)_このプロジェクト用にWikiを有効にします。代わりにwiki_access_levelを使用してください。 |
web_based_commit_signing_enabled | ブール値 | いいえ | GitLab UIから作成されたコミットに対する、Webベースのコミット署名を有効にします。GitLab.comでのみ利用可能です。 |
たとえば、GitLab.comプロジェクトのインスタンスRunnerの設定を切り替えるには、次のようにします:
curl --request PUT --header "PRIVATE-TOKEN: <your-token>" \
--url "https://gitlab.com/api/v4/projects/<your-project-ID>" \
--data "shared_runners_enabled=true" # to turn off: "shared_runners_enabled=false"アクセス制御オプションを使用したプロジェクト機能の表示レベル設定は、次のいずれかにできます:
disabled: 機能を無効にします。private: 機能を有効にして、Only project members(プロジェクトメンバーのみ)に設定します。enabled: 機能を有効にして、Everyone with access(アクセスできる人すべて)に設定します。public: 機能を有効にして、全員に設定します。pages_access_levelでのみ利用可能です。
サポートされているプロジェクトの表示レベル属性を以下に示します:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
analytics_access_level | 文字列 | いいえ | 分析の表示レベルを設定します。 |
builds_access_level | 文字列 | いいえ | パイプラインの表示レベルを設定します。 |
container_registry_access_level | 文字列 | いいえ | コンテナレジストリの表示レベルを設定します。 |
environments_access_level | 文字列 | いいえ | 環境の表示レベルを設定します。 |
feature_flags_access_level | 文字列 | いいえ | 機能フラグの表示レベルを設定します。 |
forking_access_level | 文字列 | いいえ | フォークの表示レベルを設定します。 |
infrastructure_access_level | 文字列 | いいえ | インフラストラクチャ管理の表示レベルを設定します。 |
issues_access_level | 文字列 | いいえ | イシューの表示レベルを設定します。 |
merge_requests_access_level | 文字列 | いいえ | マージリクエストの表示レベルを設定します。 |
model_experiments_access_level | 文字列 | いいえ | 機械学習モデル検証の表示レベルを設定します。 |
model_registry_access_level | 文字列 | いいえ | 機械学習モデルレジストリの表示レベルを設定します。 |
monitor_access_level | 文字列 | いいえ | アプリケーションパフォーマンスモニタリングの表示レベルを設定します。 |
pages_access_level | 文字列 | いいえ | GitLab Pagesの表示レベルを設定します。 |
releases_access_level | 文字列 | いいえ | リリースの表示レベルを設定します。 |
repository_access_level | 文字列 | いいえ | リポジトリの表示レベルを設定します。 |
requirements_access_level | 文字列 | いいえ | 要件管理の表示レベルを設定します。 |
security_and_compliance_access_level | 文字列 | いいえ | セキュリティとコンプライアンスの表示レベルを設定します。 |
snippets_access_level | 文字列 | いいえ | スニペットの表示レベルを設定します。 |
wiki_access_level | 文字列 | いいえ | Wikiの表示レベルを設定します。 |
メンバーをインポートする
別のプロジェクトからメンバーをインポートします。
ターゲットプロジェクトに対するインポートメンバーのロールによって、次のようになります:
- メンテナーの場合、ソースプロジェクトのオーナーロールを持つメンバーは、メンテナーロールでインポートされます。
- オーナーの場合、ソースプロジェクトのオーナーロールを持つメンバーは、オーナーロールでインポートされます。
POST /projects/:id/import_project_members/:project_idサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | メンバーを受け入れるターゲットプロジェクトのIDまたはURLエンコードされたパス。 |
project_id | 整数または文字列 | はい | メンバーのインポート元のソースプロジェクトのIDまたはURLエンコードされたパス。 |
リクエストの例:
curl --request POST \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/5/import_project_members/32"戻り値:
- 成功した場合は
200 OK。 - ターゲットプロジェクトまたはソースプロジェクトが存在しないか、リクエスタがアクセスできない場合は、
404 Project Not Found。 - プロジェクトメンバーのインポートが正常に完了しなかった場合は、
422 Unprocessable Entity。
レスポンス例:
すべてのメールが正常に送信された場合(HTTPステータスコード
200):{ "status": "success" }1つ以上のメンバーのインポートでエラーが発生した場合(HTTPステータスコード
200):{ "status": "error", "message": { "john_smith": "Some individual error message", "jane_smith": "Some individual error message" }, "total_members_count": 3 }システムエラーが発生した場合(HTTPステータスコード
404および422):
{ "message": "Import failed" }プロジェクトをアーカイブする
プロジェクトをアーカイブします。
前提要件:
- 管理者であるか、プロジェクトのオーナーロールが割り当てられている必要があります。
このエンドポイントはべき等です。すでにアーカイブされているプロジェクトをアーカイブしても、プロジェクトは変更されません。
POST /projects/:id/archiveサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
リクエストの例:
curl --request POST \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "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": "main",
"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/main/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",
"repository_object_format": "sha1",
"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/main/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_forward_deployment_rollback_allowed": true,
"ci_allow_fork_pipelines_to_run_in_parent_project": true,
"ci_id_token_sub_claim_components": ["project_path", "ref_type", "ref"],
"ci_separated_caches": true,
"ci_restrict_pipeline_cancellation_role": "developer",
"ci_pipeline_variables_minimum_override_role": "maintainer",
"ci_push_repository_for_job_token_allowed": false,
"public_jobs": true,
"shared_with_groups": [],
"only_allow_merge_if_pipeline_succeeds": false,
"allow_merge_on_skipped_pipeline": false,
"allow_pipeline_trigger_approve_deployment": 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,
"secret_push_protection_enabled": false,
"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"
}
}プロジェクトのアーカイブを解除する
プロジェクトのアーカイブを解除します。
前提要件:
- 管理者であるか、プロジェクトのオーナーロールが割り当てられている必要があります。
このエンドポイントはべき等です。アーカイブされていないプロジェクトのアーカイブを解除しても、プロジェクトは変更されません。
POST /projects/:id/unarchiveサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
リクエストの例:
curl --request POST \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "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": "main",
"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/main/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",
"repository_object_format": "sha1",
"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/main/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_forward_deployment_rollback_allowed": true,
"ci_allow_fork_pipelines_to_run_in_parent_project": true,
"ci_id_token_sub_claim_components": ["project_path", "ref_type", "ref"],
"ci_separated_caches": true,
"ci_restrict_pipeline_cancellation_role": "developer",
"ci_pipeline_variables_minimum_override_role": "maintainer",
"ci_push_repository_for_job_token_allowed": false,
"public_jobs": true,
"shared_with_groups": [],
"only_allow_merge_if_pipeline_succeeds": false,
"allow_merge_on_skipped_pipeline": false,
"allow_pipeline_trigger_approve_deployment": 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",
"secret_push_protection_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",
"cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
}
}プロジェクトを削除する
前提要件:
- 管理者であるか、プロジェクトのオーナーロールを持っている必要があります。
プロジェクトを削除対象としてマークします。プロジェクトは、保持期間の終了時に削除されます:
- GitLab.comでは、プロジェクトは30日間保持されます。
- GitLab Self-Managedでは、保持期間はインスタンスの設定によって制御されます。
このエンドポイントは、以前に削除対象としてマークされたプロジェクトを即座に削除することもできます。
GitLab.comでは、プロジェクトが削除された後、そのデータは30日間保持され、即時削除は利用できません。GitLab.comでプロジェクトをすぐに削除する必要がある場合は、サポートチケットを発行してください。
DELETE /projects/:idサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
full_path | 文字列 | いいえ | permanently_removeで使用するプロジェクトのフルパス。GitLab 15.11でPremiumおよびUltimate限定で導入され、18.0でGitLab Freeに移行されました。プロジェクトパスを確認するには、単一プロジェクトの取得のpath_with_namespaceを使用します。 |
permanently_remove | ブール値/文字列 | いいえ | 削除対象としてマークされているプロジェクトを即時削除します。GitLab 15.11でPremiumおよびUltimate限定で導入され、18.0でGitLab Freeに移行されました。GitLab.comとDedicatedでは無効になっています。 |
削除対象としてマークされているプロジェクトを復元する
削除対象としてマークされているプロジェクトを復元します。
POST /projects/:id/restoreサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
プロジェクトを新しいネームスペースに転送する
プロジェクトを新しいネームスペースに転送します。
プロジェクトの転送に必要な前提要件については、プロジェクトを別のネームスペースに転送を参照してください。
PUT /projects/:id/transferサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
namespace | 整数または文字列 | はい | プロジェクトの転送先のネームスペースのIDまたはパス。 |
リクエストの例:
curl --request PUT \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/5/transfer?namespace=14"レスポンス例:
{
"id": 7,
"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": "hello-world",
"name_with_namespace": "cute-cats / hello-world",
"path": "hello-world",
"path_with_namespace": "cute-cats/hello-world",
"created_at": "2020-10-15T16:25:22.415Z",
"updated_at": "2020-10-15T16:25:22.415Z",
"default_branch": "main",
"tag_list": [], //deprecated, use `topics` instead
"topics": [],
"ssh_url_to_repo": "git@gitlab.example.com:cute-cats/hello-world.git",
"http_url_to_repo": "https://gitlab.example.com/cute-cats/hello-world.git",
"web_url": "https://gitlab.example.com/cute-cats/hello-world",
"readme_url": "https://gitlab.example.com/cute-cats/hello-world/-/blob/main/README.md",
"avatar_url": null,
"forks_count": 0,
"star_count": 0,
"last_activity_at": "2020-10-15T16:25:22.415Z",
"namespace": {
"id": 18,
"name": "cute-cats",
"path": "cute-cats",
"kind": "group",
"full_path": "cute-cats",
"parent_id": null,
"avatar_url": null,
"web_url": "https://gitlab.example.com/groups/cute-cats"
},
"container_registry_image_prefix": "registry.example.com/cute-cats/hello-world",
"_links": {
"self": "https://gitlab.example.com/api/v4/projects/7",
"issues": "https://gitlab.example.com/api/v4/projects/7/issues",
"merge_requests": "https://gitlab.example.com/api/v4/projects/7/merge_requests",
"repo_branches": "https://gitlab.example.com/api/v4/projects/7/repository/branches",
"labels": "https://gitlab.example.com/api/v4/projects/7/labels",
"events": "https://gitlab.example.com/api/v4/projects/7/events",
"members": "https://gitlab.example.com/api/v4/projects/7/members"
},
"packages_enabled": true, // deprecated, use package_registry_access_level instead
"package_registry_access_level": "enabled",
"empty_repo": false,
"archived": false,
"visibility": "private",
"resolve_outdated_diff_discussions": false,
"container_registry_enabled": true, // deprecated, use container_registry_access_level instead
"container_registry_access_level": "enabled",
"container_expiration_policy": {
"cadence": "7d",
"enabled": false,
"keep_n": null,
"older_than": null,
"name_regex": null,
"name_regex_keep": null,
"next_run_at": "2020-10-22T16:25:22.746Z"
},
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"jobs_enabled": true,
"snippets_enabled": true,
"service_desk_enabled": false,
"service_desk_address": null,
"can_create_merge_request_in": true,
"issues_access_level": "enabled",
"repository_access_level": "enabled",
"merge_requests_access_level": "enabled",
"forking_access_level": "enabled",
"analytics_access_level": "enabled",
"wiki_access_level": "enabled",
"builds_access_level": "enabled",
"snippets_access_level": "enabled",
"pages_access_level": "enabled",
"security_and_compliance_access_level": "enabled",
"emails_disabled": null,
"emails_enabled": null,
"shared_runners_enabled": true,
"group_runners_enabled": true,
"lfs_enabled": true,
"creator_id": 2,
"import_status": "none",
"open_issues_count": 0,
"ci_default_git_depth": 50,
"public_jobs": true,
"build_timeout": 3600,
"auto_cancel_pending_pipelines": "enabled",
"ci_config_path": null,
"shared_with_groups": [],
"only_allow_merge_if_pipeline_succeeds": false,
"allow_merge_on_skipped_pipeline": null,
"allow_pipeline_trigger_approve_deployment": false,
"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_on",
"suggestion_commit_message": null,
"merge_commit_template": null,
"auto_devops_enabled": true,
"auto_devops_deploy_strategy": "continuous",
"autoclose_referenced_issues": true,
"approvals_before_merge": 0, // Deprecated. Use merge request approvals API instead.
"mirror": false,
"compliance_frameworks": [],
"warn_about_potentially_unwanted_characters": true,
"secret_push_protection_enabled": false
}プロジェクト転送に利用可能なグループのリストを取得する
ユーザーがプロジェクトを転送できる転送先グループのリストを取得します。
GET /projects/:id/transfer_locationsサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
search | 文字列 | いいえ | 検索するグループ名。 |
リクエストの例:
curl --url "https://gitlab.example.com/api/v4/projects/1/transfer_locations"レスポンス例:
[
{
"id": 27,
"web_url": "https://gitlab.example.com/groups/gitlab",
"name": "GitLab",
"avatar_url": null,
"full_name": "GitLab",
"full_path": "GitLab"
},
{
"id": 31,
"web_url": "https://gitlab.example.com/groups/foobar",
"name": "FooBar",
"avatar_url": null,
"full_name": "FooBar",
"full_path": "FooBar"
}
]プロジェクトアバターをアップロードする
指定されたプロジェクトにアバターをアップロードします。
PUT /projects/:idサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
avatar | 文字列 | はい | アップロードするファイル。 |
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
ファイルシステムからアバターをアップロードするには、--form引数を使用します。これにより、cURLはヘッダーContent-Type: multipart/form-dataを使用してデータを送信します。file=パラメータは、ファイルシステムの画像ファイルを指しており、先頭に@を付ける必要があります。次に例を示します:
リクエストの例:
curl --request PUT \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/5" \
--form "avatar=@dk.png"レスポンス例:
{
"avatar_url": "https://gitlab.example.com/uploads/-/system/project/avatar/2/dk.png"
}プロジェクトアバターをダウンロードする
プロジェクトアバターをダウンロードします。プロジェクトが公開されている場合、このエンドポイントには認証なしでアクセスできます。
GET /projects/:id/avatarサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
リクエストの例:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/4/avatar"プロジェクトアバターを削除する
プロジェクトアバターを削除するには、avatar属性に空白の値を指定します。
リクエストの例:
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
--data "avatar=" "https://gitlab.example.com/api/v4/projects/5"プロジェクトを共有する
プロジェクトをグループと共有します。
プロジェクトをグループと共有する
プロジェクトをグループと共有します。
POST /projects/:id/shareサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
group_access | 整数 | はい | グループに付与するロール(access_level)。 |
group_id | 整数 | はい | 共有するグループのID。 |
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
expires_at | 文字列 | いいえ | ISO 8601形式での共有有効期限。例: 2016-09-26。 |
グループ内の共有プロジェクトリンクを削除する
グループからプロジェクトの共有を解除します。成功すると204が返されますが、コンテンツは返されません。
DELETE /projects/:id/share/:group_idサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
group_id | 整数 | はい | グループのID。 |
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
リクエストの例:
curl --request DELETE \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/5/share/17"プロジェクトのハウスキーピングタスクを開始する
プロジェクトのハウスキーピングタスクを開始します。
POST /projects/:id/housekeepingサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
task | 文字列 | いいえ | 到達不能なオブジェクトの手動プルーニングをトリガーする場合はprune、積極的なハウスキーピングをトリガーする場合はeager。 |
リアルタイムセキュリティスキャン
- プラン: Ultimate
- 提供形態: GitLab.com
- ステータス: 実験的機能
リアルタイムで1つのファイルのSASTスキャン結果を返します。
POST /projects/:id/security_scans/sast/scanサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
リクエストの例:
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
--header "Content-Type: application/json" \
--data '{
"file_path":"src/main.c",
"content":"#include<string.h>\nint main(int argc, char **argv) {\n char buff[128];\n strcpy(buff, argv[1]);\n return 0;\n}\n"
}' \
--url "https://gitlab.example.com/api/v4/projects/:id/security_scans/sast/scan"レスポンス例:
{
"vulnerabilities": [
{
"name": "Insecure string processing function (strcpy)",
"description": "The `strcpy` family of functions do not provide the ability to limit or check buffer\nsizes before copying to a destination buffer. This can lead to buffer overflows. Consider\nusing more secure alternatives such as `strncpy` and provide the correct limit to the\ndestination buffer and ensure the string is null terminated.\n\nFor more information please see: https://linux.die.net/man/3/strncpy\n\nIf developing for C Runtime Library (CRT), more secure versions of these functions should be\nused, see:\nhttps://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/strncpy-s-strncpy-s-l-wcsncpy-s-wcsncpy-s-l-mbsncpy-s-mbsncpy-s-l?view=msvc-170\n",
"severity": "High",
"location": {
"file": "src/main.c",
"start_line": 5,
"end_line": 5,
"start_column": 3,
"end_column": 23
}
}
]
}Gitリポジトリのスナップショットをダウンロードする
このエンドポイントには、管理者のみがアクセスできます。
プロジェクト(またはリクエストされた場合はWiki)のGitリポジトリのスナップショットをダウンロードします。このスナップショットは、常に非圧縮のtar形式です。
リポジトリが破損してgit cloneが機能しない場合でも、スナップショットを使用すると、一部のデータを取得できる場合があります。
GET /projects/:id/snapshotサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
wiki | ブール値 | いいえ | プロジェクトリポジトリではなく、Wikiをダウンロードするかどうか。 |
リポジトリストレージへのパスを取得する
指定されたプロジェクトのリポジトリストレージへのパスを取得します。Gitaly Cluster(Praefect)を使用している場合は、代わりにPraefectによって生成されたレプリカパスを参照してください。
管理者のみが利用できます。
GET /projects/:id/storageサポートされている属性:
| 属性 | 種類 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
[
{
"project_id": 1,
"disk_path": "@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b",
"created_at": "2012-10-12T17:04:47Z",
"repository_storage": "default"
}
]シークレットプッシュ保護のステータス
- プラン: Ultimate
デベロッパー以上のロールが付与されている場合、次のリクエストはsecret_push_protection_enabled値も返す可能性があります。これらのリクエストの一部には、ロールに関するより厳格な要件があります。詳細については、前述のエンドポイントを参照してください。この情報を使用して、プロジェクトに対してシークレットプッシュ保護が有効になっているかどうかを判断します。secret_push_protection_enabledの値を変更するには、プロジェクトセキュリティ設定APIを使用してください。
GET /projectsGET /projects/:idGET /users/:user_id/projectsGET /users/:user_id/contributed_projectsPUT /projects/:project_id/transfer?namespace=:namespace_idPUT /projects/:idPOST /projectsPOST /projects/user/:user_idPOST /projects/:id/archivePOST /projects/:id/unarchive
レスポンス例:
{
"id": 1,
"project_id": 3,
"secret_push_protection_enabled": true,
...
}トラブルシューティング
応答の予期しないrestrict_user_defined_variables値
restrict_user_defined_variablesとci_pipeline_variables_minimum_override_roleに競合する値を設定すると、pipeline_variables_minimum_override_role設定の方が優先順位が高いため、応答の値が予期される値と異なる場合があります。
たとえば、次のような場合が該当します:
restrict_user_defined_variablesをtrue、ci_pipeline_variables_minimum_override_roleをdeveloperに設定すると、応答はrestrict_user_defined_variables: falseを返します。ci_pipeline_variables_minimum_override_roleをdeveloperに設定すると、優先され、変数は制限されません。restrict_user_defined_variablesをfalse、ci_pipeline_variables_minimum_override_roleをmaintainerに設定すると、応答はrestrict_user_defined_variables: trueを返します。ci_pipeline_variables_minimum_override_roleをmaintainerに設定すると優先され、変数が制限されるためです。