スポンサーリンク

GitLab API の 簡単な使い方

スポンサーリンク
Git
スポンサーリンク

スポンサーリンク

概要

GitLabではREST API が提供されています。これを用いて操作の自動化や情報の取得ができます。ここではAPIの利用のレギュラーパターンをまとめてみました。
また、APIの利用にはいくつかの原則ルールがあるので、簡単に触れます。
ここで紹介しているパラメータはAPI v4に基づいていますが、GitLabのバージョンで利用できる機能が異なったりします。

原則:アクセストークン

API Docs | GitLab
Documentation for GitLab Community Edition, GitLab Enterprise Edition, Omnibus GitLab, and GitLab Runner.

利用には各アカウントで払い出されたアクセストークンの利用が必要となります。APIでのトークンの送信方法は2つあり
GETパラメータに付与する場合、”private_token=${アクセストークン}”、
headerに付与する場合、”Private-Token”にアクセストークンをセットします。

原則:ページネーション

API Docs | GitLab
Documentation for GitLab Community Edition, GitLab Enterprise Edition, Omnibus GitLab, and GitLab Runner.

大量のデータを送らないようにページネーションの仕組みがあります。
ページ番号を指定するパラメータ”page”とページのアイテム数の上限を指定する”per_page”があります。per_pageの上限は100です。
(例: 50アイテムづつ区切り、2ページ目を取得する)

page=2&per_page=50

また、APIのレスポンスのヘッダの中に、ページネーションの情報が格納されます。

HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 1103
Content-Type: application/json
Date: Mon, 18 Jan 2016 09:43:18 GMT
Link: ; rel="prev", ; rel="next", ; rel="first", ; rel="last"
Status: 200 OK
Vary: Origin
X-Next-Page: 3
X-Page: 2
X-Per-Page: 3
X-Prev-Page: 1
X-Request-Id: 732ad4ee-9870-4866-a199-a9db0cde3c86
X-Runtime: 0.108688
X-Total: 8
X-Total-Pages: 3

プロジェクトを取得する

プロジェクト一覧表示

リクエスト

/api/v4/projects
(例: /api/v4/projects?pagination=keyset&per_page=100&page=1&order_by=id&sort=asc)

レスポンス

[
    {
        "id": 143,
        "description": null,
        "name": "TearDownWalls",
        "name_with_namespace": "Leberwurscht / TearDownWalls",
        "path": "teardownwalls",
        "path_with_namespace": "leberwurscht/teardownwalls",
        "created_at": "2012-10-15T17:26:53.000Z",
        "default_branch": "master",
        "tag_list": [],
        "ssh_url_to_repo": "git@gitlab.com:leberwurscht/teardownwalls.git",
        "http_url_to_repo": "https://gitlab.com/leberwurscht/teardownwalls.git",
        "web_url": "https://gitlab.com/leberwurscht/teardownwalls",
        "readme_url": "https://gitlab.com/leberwurscht/teardownwalls/-/blob/master/README.md",
        "avatar_url": null,
        "star_count": 1,
        "forks_count": 4,
        "last_activity_at": "2013-10-03T08:08:46.000Z",
        "namespace": {
            "id": 262,
            "name": "Leberwurscht",
            "path": "leberwurscht",
            "kind": "user",
            "full_path": "leberwurscht",
            "parent_id": null,
            "avatar_url": "https://secure.gravatar.com/avatar/40e7a18eaeab7e309ae33992fef64ab4?s=80\u0026d=identicon",
            "web_url": "https://gitlab.com/leberwurscht"
        },
        "_links": {
            "self": "https://gitlab.com/api/v4/projects/143",
            "issues": "https://gitlab.com/api/v4/projects/143/issues",
            "merge_requests": "https://gitlab.com/api/v4/projects/143/merge_requests",
            "repo_branches": "https://gitlab.com/api/v4/projects/143/repository/branches",
            "labels": "https://gitlab.com/api/v4/projects/143/labels",
            "events": "https://gitlab.com/api/v4/projects/143/events",
            "members": "https://gitlab.com/api/v4/projects/143/members"
        },
        "empty_repo": false,
        "archived": false,
        "visibility": "public",
        "owner": {
            "id": 333,
            "name": "Leberwurscht",
            "username": "leberwurscht",
            "state": "active",
            "avatar_url": "https://secure.gravatar.com/avatar/40e7a18eaeab7e309ae33992fef64ab4?s=80\u0026d=identicon",
            "web_url": "https://gitlab.com/leberwurscht"
        },
        "resolve_outdated_diff_discussions": null,
        "container_registry_enabled": null,
        "issues_enabled": true,
        "merge_requests_enabled": true,
        "wiki_enabled": true,
        "jobs_enabled": true,
        "snippets_enabled": false,
        "can_create_merge_request_in": true,
        "issues_access_level": "enabled",
        "repository_access_level": "enabled",
        "merge_requests_access_level": "enabled",
        "wiki_access_level": "enabled",
        "builds_access_level": "enabled",
        "snippets_access_level": "disabled",
        "pages_access_level": "enabled",
        "emails_disabled": null,
        "shared_runners_enabled": true,
        "lfs_enabled": true,
        "creator_id": 333,
        "import_status": "none",
        "open_issues_count": 0,
        "ci_default_git_depth": null,
        "public_jobs": true,
        "build_timeout": 3600,
        "auto_cancel_pending_pipelines": "enabled",
        "build_coverage_regex": null,
        "ci_config_path": null,
        "shared_with_groups": [],
        "only_allow_merge_if_pipeline_succeeds": false,
        "request_access_enabled": true,
        "only_allow_merge_if_all_discussions_are_resolved": null,
        "remove_source_branch_after_merge": null,
        "printing_merge_request_link_enabled": true,
        "merge_method": "merge",
        "suggestion_commit_message": null,
        "auto_devops_enabled": false,
        "auto_devops_deploy_strategy": "continuous",
        "autoclose_referenced_issues": true,
        "permissions": {
            "project_access": null,
            "group_access": null
        },
        "approvals_before_merge": 0,
        "mirror": false,
        "external_authorization_classification_label": "",
        "packages_enabled": null,
        "service_desk_enabled": null,
        "service_desk_address": null,
        "marked_for_deletion_at": null
    }
]

指定IDのプロジェクトを表示

リクエスト

/api/v4/projects/:id
(例: /api/v4/projects/278964)

レスポンス

{
    "id": 278964,
    "description": "GitLab is an open source end-to-end software development platform with built-in version control, issue tracking, code review, CI/CD, and more. Self-host GitLab on your own servers, in a container, or on a cloud provider.",
    "name": "GitLab",
    "name_with_namespace": "GitLab.org / GitLab",
    "path": "gitlab",
    "path_with_namespace": "gitlab-org/gitlab",
    "created_at": "2015-05-20T10:47:11.949Z",
    "default_branch": "master",
    "tag_list": [],
    "ssh_url_to_repo": "git@gitlab.com:gitlab-org/gitlab.git",
    "http_url_to_repo": "https://gitlab.com/gitlab-org/gitlab.git",
    "web_url": "https://gitlab.com/gitlab-org/gitlab",
    "readme_url": "https://gitlab.com/gitlab-org/gitlab/-/blob/master/README.md",
    "avatar_url": "https://assets.gitlab-static.net/uploads/-/system/project/avatar/278964/logo-extra-whitespace.png",
    "star_count": 1451,
    "forks_count": 1520,
    "last_activity_at": "2020-02-10T08:34:12.712Z",
    "namespace": {
        "id": 9970,
        "name": "GitLab.org",
        "path": "gitlab-org",
        "kind": "group",
        "full_path": "gitlab-org",
        "parent_id": null,
        "avatar_url": "/uploads/-/system/group/avatar/9970/logo-extra-whitespace.png",
        "web_url": "https://gitlab.com/groups/gitlab-org"
    },
    "_links": {
        "self": "https://gitlab.com/api/v4/projects/278964",
        "issues": "https://gitlab.com/api/v4/projects/278964/issues",
        "merge_requests": "https://gitlab.com/api/v4/projects/278964/merge_requests",
        "repo_branches": "https://gitlab.com/api/v4/projects/278964/repository/branches",
        "labels": "https://gitlab.com/api/v4/projects/278964/labels",
        "events": "https://gitlab.com/api/v4/projects/278964/events",
        "members": "https://gitlab.com/api/v4/projects/278964/members"
    },
    "empty_repo": false,
    "archived": false,
    "visibility": "public",
    "resolve_outdated_diff_discussions": false,
    "container_registry_enabled": true,
    "issues_enabled": true,
    "merge_requests_enabled": true,
    "wiki_enabled": false,
    "jobs_enabled": true,
    "snippets_enabled": true,
    "can_create_merge_request_in": true,
    "issues_access_level": "enabled",
    "repository_access_level": "enabled",
    "merge_requests_access_level": "enabled",
    "wiki_access_level": "disabled",
    "builds_access_level": "enabled",
    "snippets_access_level": "enabled",
    "pages_access_level": "enabled",
    "emails_disabled": false,
    "shared_runners_enabled": true,
    "lfs_enabled": true,
    "creator_id": 5497,
    "import_status": "finished",
    "open_issues_count": 25237,
    "ci_default_git_depth": null,
    "public_jobs": true,
    "build_timeout": 7680,
    "auto_cancel_pending_pipelines": "enabled",
    "build_coverage_regex": "",
    "ci_config_path": "",
    "shared_with_groups": [
        {
            "group_id": 3205033,
            "group_name": "gl-quality",
            "group_full_path": "gl-quality",
            "group_access_level": 30,
            "expires_at": null
        },
        {
            "group_id": 6150316,
            "group_name": "frontend",
            "group_full_path": "gitlab-org/maintainers/frontend",
            "group_access_level": 30,
            "expires_at": null
        },
        {
            "group_id": 1356356,
            "group_name": "GitLab docs team",
            "group_full_path": "gl-docsteam",
            "group_access_level": 30,
            "expires_at": null
        },
        {
            "group_id": 5924764,
            "group_name": "database",
            "group_full_path": "gitlab-org/maintainers/database",
            "group_access_level": 30,
            "expires_at": null
        },
        {
            "group_id": 5747833,
            "group_name": "eng-prod",
            "group_full_path": "gl-quality/eng-prod",
            "group_access_level": 30,
            "expires_at": null
        },
        {
            "group_id": 3887968,
            "group_name": "rails-backend",
            "group_full_path": "gitlab-org/maintainers/rails-backend",
            "group_access_level": 40,
            "expires_at": null
        },
        {
            "group_id": 2584649,
            "group_name": "managers",
            "group_full_path": "gitlab-org/release/managers",
            "group_access_level": 40,
            "expires_at": null
        }
    ],
    "only_allow_merge_if_pipeline_succeeds": false,
    "request_access_enabled": false,
    "only_allow_merge_if_all_discussions_are_resolved": true,
    "remove_source_branch_after_merge": true,
    "printing_merge_request_link_enabled": true,
    "merge_method": "merge",
    "suggestion_commit_message": "",
    "auto_devops_enabled": false,
    "auto_devops_deploy_strategy": "continuous",
    "autoclose_referenced_issues": true,
    "permissions": {
        "project_access": null,
        "group_access": null
    },
    "approvals_before_merge": 1,
    "mirror": false,
    "external_authorization_classification_label": "",
    "packages_enabled": false,
    "service_desk_enabled": false,
    "service_desk_address": null,
    "marked_for_deletion_at": null
}

その他

ResourceAvailable endpoints
Access requests/projects/:id/access_requests (also available for groups)
Award emoji/projects/:id/issues/.../award_emoji/projects/:id/merge_requests/.../award_emoji/projects/:id/snippets/.../award_emoji
Branches/projects/:id/repository/branches//projects/:id/repository/merged_branches
Commits/projects/:id/repository/commits/projects/:id/statuses
Container Registry/projects/:id/registry/repositories
Custom attributes/projects/:id/custom_attributes (also available for groups and users)
Dependencies /projects/:id/dependencies
Deploy keys/projects/:id/deploy_keys (also available standalone)
Deployments/projects/:id/deployments
Discussions (threaded comments)/projects/:id/issues/.../discussions/projects/:id/snippets/.../discussions/projects/:id/merge_requests/.../discussions/projects/:id/commits/.../discussions (also available for groups)
Environments/projects/:id/environments
Error Tracking/projects/:id/error_tracking/settings
Events/projects/:id/events (also available for users and standalone)
Issues/projects/:id/issues (also available for groups and standalone)
Issues Statistics/projects/:id/issues_statistics (also available for groups and standalone)
Issue boards/projects/:id/boards
Issue links /projects/:id/issues/.../links
Jobs/projects/:id/jobs/projects/:id/pipelines/.../jobs
Labels/projects/:id/labels
Managed licenses /projects/:id/managed_licenses
Members/projects/:id/members (also available for groups)
Merge request approvals /projects/:id/approvals/projects/:id/merge_requests/.../approvals
Merge requests/projects/:id/merge_requests (also available for groups and standalone)
Notes (comments)/projects/:id/issues/.../notes/projects/:id/snippets/.../notes/projects/:id/merge_requests/.../notes (also available for groups)
Notification settings/projects/:id/notification_settings (also available for groups and standalone)
Packages /projects/:id/packages
Pages domains/projects/:id/pages (also available standalone)
Pipelines/projects/:id/pipelines
Pipeline schedules/projects/:id/pipeline_schedules
Pipeline triggers/projects/:id/triggers
Projects including setting Webhooks/projects/projects/:id/hooks (also available for users)
Project badges/projects/:id/badges
Project clusters/projects/:id/clusters
Project-level variables/projects/:id/variables
Project import/export/projects/:id/export/projects/import/projects/:id/import
Project milestones/projects/:id/milestones
Project snippets/projects/:id/snippets
Project templates/projects/:id/templates
Protected_environments/projects/:id/protected_environments
Protected branches/projects/:id/protected_branches
Protected tags/projects/:id/protected_tags
Releases/projects/:id/releases
Release links/projects/:id/releases/.../assets/links
Repositories/projects/:id/repository
Repository files/projects/:id/repository/files
Repository submodules/projects/:id/repository/submodules
Resource label events/projects/:id/issues/.../resource_label_events/projects/:id/merge_requests/.../resource_label_events (also available for groups)
Runners/projects/:id/runners (also available standalone)
Search/projects/:id/search (also available for groups and standalone)
Services/projects/:id/services
Tags/projects/:id/repository/tags
Visual Review discussions (STARTER)/projects/:id/merge_requests/:merge_request_id/visual_review_discussions
Vulnerabilities /projects/:id/vulnerabilities
Vulnerability Findings /projects/:id/vulnerability_findings
Wikis/projects/:id/wikis

グループを取得する

指定のグループの情報を表示

リクエスト

/api/v4/groups/:id
(例: /api/v4/groups/3205033)

レスポンス

{
    "id": 3205033,
    "web_url": "https://gitlab.com/groups/gl-quality",
    "name": "gl-quality",
    "path": "gl-quality",
    "description": "GitLab Quality user group for @ mentions (no projects)",
    "visibility": "public",
    "share_with_group_lock": false,
    "require_two_factor_authentication": false,
    "two_factor_grace_period": 48,
    "project_creation_level": "developer",
    "auto_devops_enabled": null,
    "subgroup_creation_level": "owner",
    "emails_disabled": null,
    "mentions_disabled": null,
    "lfs_enabled": false,
    "avatar_url": null,
    "request_access_enabled": false,
    "full_name": "gl-quality",
    "full_path": "gl-quality",
    "parent_id": null,
    "ldap_cn": null,
    "ldap_access": null,
    "projects": [],
    "shared_projects": [
        {
            "id": 9636672,
            "description": "Async retrospectives for the Quality department.",
            "name": "Quality retrospectives",
            "name_with_namespace": "GitLab team retrospectives / Quality retrospectives",
            "path": "quality",
            "path_with_namespace": "gl-retrospectives/quality",
            "created_at": "2018-11-27T10:22:13.077Z",
            "tag_list": [],
            "ssh_url_to_repo": "git@gitlab.com:gl-retrospectives/quality.git",
            "http_url_to_repo": "https://gitlab.com/gl-retrospectives/quality.git",
            "web_url": "https://gitlab.com/gl-retrospectives/quality",
            "readme_url": null,
            "avatar_url": null,
            "star_count": 0,
            "forks_count": 0,
            "last_activity_at": "2020-02-05T02:11:27.376Z",
            "namespace": {
                "id": 3068744,
                "name": "GitLab team retrospectives",
                "path": "gl-retrospectives",
                "kind": "group",
                "full_path": "gl-retrospectives",
                "parent_id": null,
                "avatar_url": null,
                "web_url": "https://gitlab.com/groups/gl-retrospectives"
            },
            "_links": {
                "self": "https://gitlab.com/api/v4/projects/9636672",
                "issues": "https://gitlab.com/api/v4/projects/9636672/issues",
                "repo_branches": "https://gitlab.com/api/v4/projects/9636672/repository/branches",
                "labels": "https://gitlab.com/api/v4/projects/9636672/labels",
                "events": "https://gitlab.com/api/v4/projects/9636672/events",
                "members": "https://gitlab.com/api/v4/projects/9636672/members"
            },
            "empty_repo": true,
            "archived": false,
            "visibility": "public",
            "resolve_outdated_diff_discussions": false,
            "container_registry_enabled": false,
            "issues_enabled": true,
            "merge_requests_enabled": false,
            "wiki_enabled": false,
            "jobs_enabled": false,
            "snippets_enabled": false,
            "can_create_merge_request_in": false,
            "issues_access_level": "enabled",
            "repository_access_level": "disabled",
            "merge_requests_access_level": "disabled",
            "wiki_access_level": "disabled",
            "builds_access_level": "disabled",
            "snippets_access_level": "disabled",
            "pages_access_level": "enabled",
            "emails_disabled": null,
            "shared_runners_enabled": true,
            "lfs_enabled": false,
            "creator_id": 443319,
            "import_status": "none",
            "open_issues_count": 0,
            "ci_default_git_depth": null,
            "public_jobs": true,
            "build_timeout": 3600,
            "auto_cancel_pending_pipelines": "enabled",
            "build_coverage_regex": null,
            "shared_with_groups": [
                {
                    "group_id": 3205033,
                    "group_name": "gl-quality",
                    "group_full_path": "gl-quality",
                    "group_access_level": 30,
                    "expires_at": null
                }
            ],
            "only_allow_merge_if_pipeline_succeeds": false,
            "request_access_enabled": false,
            "only_allow_merge_if_all_discussions_are_resolved": false,
            "remove_source_branch_after_merge": null,
            "printing_merge_request_link_enabled": true,
            "merge_method": "merge",
            "suggestion_commit_message": null,
            "auto_devops_enabled": false,
            "auto_devops_deploy_strategy": "continuous",
            "autoclose_referenced_issues": true,
            "approvals_before_merge": 0,
            "mirror": false,
            "external_authorization_classification_label": "",
            "packages_enabled": false,
            "service_desk_enabled": true,
            "service_desk_address": "incoming+gl-retrospectives-quality-9636672-issue-@incoming.gitlab.com",
            "marked_for_deletion_at": null
        },
        {
            "id": 3430480,
            "description": "GitLab's issues and merge requests triage, automated!",
            "name": "GitLab Triage",
            "name_with_namespace": "GitLab.org / GitLab Triage",
            "path": "gitlab-triage",
            "path_with_namespace": "gitlab-org/gitlab-triage",
            "created_at": "2017-06-03T04:10:44.539Z",
            "default_branch": "master",
            "tag_list": [],
            "ssh_url_to_repo": "git@gitlab.com:gitlab-org/gitlab-triage.git",
            "http_url_to_repo": "https://gitlab.com/gitlab-org/gitlab-triage.git",
            "web_url": "https://gitlab.com/gitlab-org/gitlab-triage",
            "readme_url": "https://gitlab.com/gitlab-org/gitlab-triage/-/blob/master/README.md",
            "avatar_url": null,
            "star_count": 76,
            "forks_count": 27,
            "last_activity_at": "2020-02-04T18:09:48.090Z",
            "namespace": {
                "id": 9970,
                "name": "GitLab.org",
                "path": "gitlab-org",
                "kind": "group",
                "full_path": "gitlab-org",
                "parent_id": null,
                "avatar_url": "/uploads/-/system/group/avatar/9970/logo-extra-whitespace.png",
                "web_url": "https://gitlab.com/groups/gitlab-org"
            },
            "_links": {
                "self": "https://gitlab.com/api/v4/projects/3430480",
                "issues": "https://gitlab.com/api/v4/projects/3430480/issues",
                "merge_requests": "https://gitlab.com/api/v4/projects/3430480/merge_requests",
                "repo_branches": "https://gitlab.com/api/v4/projects/3430480/repository/branches",
                "labels": "https://gitlab.com/api/v4/projects/3430480/labels",
                "events": "https://gitlab.com/api/v4/projects/3430480/events",
                "members": "https://gitlab.com/api/v4/projects/3430480/members"
            },
            "empty_repo": false,
            "archived": false,
            "visibility": "public",
            "resolve_outdated_diff_discussions": false,
            "container_registry_enabled": false,
            "issues_enabled": true,
            "merge_requests_enabled": true,
            "wiki_enabled": false,
            "jobs_enabled": true,
            "snippets_enabled": false,
            "can_create_merge_request_in": true,
            "issues_access_level": "enabled",
            "repository_access_level": "enabled",
            "merge_requests_access_level": "enabled",
            "wiki_access_level": "disabled",
            "builds_access_level": "enabled",
            "snippets_access_level": "disabled",
            "pages_access_level": "enabled",
            "emails_disabled": null,
            "shared_runners_enabled": true,
            "lfs_enabled": true,
            "creator_id": 419655,
            "import_status": "none",
            "open_issues_count": 72,
            "ci_default_git_depth": null,
            "public_jobs": true,
            "build_timeout": 36000,
            "auto_cancel_pending_pipelines": "enabled",
            "build_coverage_regex": "",
            "ci_config_path": null,
            "shared_with_groups": [
                {
                    "group_id": 3205033,
                    "group_name": "gl-quality",
                    "group_full_path": "gl-quality",
                    "group_access_level": 40,
                    "expires_at": null
                }
            ],
            "only_allow_merge_if_pipeline_succeeds": true,
            "request_access_enabled": false,
            "only_allow_merge_if_all_discussions_are_resolved": true,
            "remove_source_branch_after_merge": null,
            "printing_merge_request_link_enabled": true,
            "merge_method": "merge",
            "suggestion_commit_message": null,
            "auto_devops_enabled": false,
            "auto_devops_deploy_strategy": "continuous",
            "autoclose_referenced_issues": true,
            "approvals_before_merge": 1,
            "mirror": false,
            "external_authorization_classification_label": "",
            "packages_enabled": null,
            "service_desk_enabled": null,
            "service_desk_address": null,
            "marked_for_deletion_at": null
        },
        {
            "id": 1441932,
            "description": "An orchestration tool that enables running various end-to-end scenarios against any GitLab instance.",
            "name": "GitLab QA",
            "name_with_namespace": "GitLab.org / GitLab QA",
            "path": "gitlab-qa",
            "path_with_namespace": "gitlab-org/gitlab-qa",
            "created_at": "2016-07-25T10:35:44.335Z",
            "default_branch": "master",
            "tag_list": [],
            "ssh_url_to_repo": "git@gitlab.com:gitlab-org/gitlab-qa.git",
            "http_url_to_repo": "https://gitlab.com/gitlab-org/gitlab-qa.git",
            "web_url": "https://gitlab.com/gitlab-org/gitlab-qa",
            "readme_url": "https://gitlab.com/gitlab-org/gitlab-qa/-/blob/master/README.md",
            "avatar_url": null,
            "star_count": 34,
            "forks_count": 25,
            "last_activity_at": "2020-02-10T07:08:31.497Z",
            "namespace": {
                "id": 9970,
                "name": "GitLab.org",
                "path": "gitlab-org",
                "kind": "group",
                "full_path": "gitlab-org",
                "parent_id": null,
                "avatar_url": "/uploads/-/system/group/avatar/9970/logo-extra-whitespace.png",
                "web_url": "https://gitlab.com/groups/gitlab-org"
            },
            "_links": {
                "self": "https://gitlab.com/api/v4/projects/1441932",
                "issues": "https://gitlab.com/api/v4/projects/1441932/issues",
                "merge_requests": "https://gitlab.com/api/v4/projects/1441932/merge_requests",
                "repo_branches": "https://gitlab.com/api/v4/projects/1441932/repository/branches",
                "labels": "https://gitlab.com/api/v4/projects/1441932/labels",
                "events": "https://gitlab.com/api/v4/projects/1441932/events",
                "members": "https://gitlab.com/api/v4/projects/1441932/members"
            },
            "empty_repo": false,
            "archived": false,
            "visibility": "public",
            "resolve_outdated_diff_discussions": false,
            "container_registry_enabled": true,
            "issues_enabled": true,
            "merge_requests_enabled": true,
            "wiki_enabled": true,
            "jobs_enabled": true,
            "snippets_enabled": true,
            "can_create_merge_request_in": true,
            "issues_access_level": "enabled",
            "repository_access_level": "enabled",
            "merge_requests_access_level": "enabled",
            "wiki_access_level": "enabled",
            "builds_access_level": "enabled",
            "snippets_access_level": "enabled",
            "pages_access_level": "enabled",
            "emails_disabled": null,
            "shared_runners_enabled": false,
            "lfs_enabled": true,
            "creator_id": 263716,
            "import_status": "none",
            "open_issues_count": 66,
            "ci_default_git_depth": null,
            "public_jobs": false,
            "build_timeout": 7200,
            "auto_cancel_pending_pipelines": "enabled",
            "build_coverage_regex": "",
            "ci_config_path": "",
            "shared_with_groups": [
                {
                    "group_id": 3205033,
                    "group_name": "gl-quality",
                    "group_full_path": "gl-quality",
                    "group_access_level": 40,
                    "expires_at": null
                }
            ],
            "only_allow_merge_if_pipeline_succeeds": false,
            "request_access_enabled": false,
            "only_allow_merge_if_all_discussions_are_resolved": true,
            "remove_source_branch_after_merge": true,
            "printing_merge_request_link_enabled": true,
            "merge_method": "merge",
            "suggestion_commit_message": null,
            "auto_devops_enabled": false,
            "auto_devops_deploy_strategy": "continuous",
            "autoclose_referenced_issues": true,
            "approvals_before_merge": 1,
            "mirror": false,
            "external_authorization_classification_label": "",
            "packages_enabled": null,
            "service_desk_enabled": null,
            "service_desk_address": null,
            "marked_for_deletion_at": null
        },
        {
            "id": 278964,
            "description": "GitLab is an open source end-to-end software development platform with built-in version control, issue tracking, code review, CI/CD, and more. Self-host GitLab on your own servers, in a container, or on a cloud provider.",
            "name": "GitLab",
            "name_with_namespace": "GitLab.org / GitLab",
            "path": "gitlab",
            "path_with_namespace": "gitlab-org/gitlab",
            "created_at": "2015-05-20T10:47:11.949Z",
            "default_branch": "master",
            "tag_list": [],
            "ssh_url_to_repo": "git@gitlab.com:gitlab-org/gitlab.git",
            "http_url_to_repo": "https://gitlab.com/gitlab-org/gitlab.git",
            "web_url": "https://gitlab.com/gitlab-org/gitlab",
            "readme_url": "https://gitlab.com/gitlab-org/gitlab/-/blob/master/README.md",
            "avatar_url": "https://assets.gitlab-static.net/uploads/-/system/project/avatar/278964/logo-extra-whitespace.png",
            "star_count": 1451,
            "forks_count": 1520,
            "last_activity_at": "2020-02-10T09:34:25.026Z",
            "namespace": {
                "id": 9970,
                "name": "GitLab.org",
                "path": "gitlab-org",
                "kind": "group",
                "full_path": "gitlab-org",
                "parent_id": null,
                "avatar_url": "/uploads/-/system/group/avatar/9970/logo-extra-whitespace.png",
                "web_url": "https://gitlab.com/groups/gitlab-org"
            },
            "_links": {
                "self": "https://gitlab.com/api/v4/projects/278964",
                "issues": "https://gitlab.com/api/v4/projects/278964/issues",
                "merge_requests": "https://gitlab.com/api/v4/projects/278964/merge_requests",
                "repo_branches": "https://gitlab.com/api/v4/projects/278964/repository/branches",
                "labels": "https://gitlab.com/api/v4/projects/278964/labels",
                "events": "https://gitlab.com/api/v4/projects/278964/events",
                "members": "https://gitlab.com/api/v4/projects/278964/members"
            },
            "empty_repo": false,
            "archived": false,
            "visibility": "public",
            "resolve_outdated_diff_discussions": false,
            "container_registry_enabled": true,
            "issues_enabled": true,
            "merge_requests_enabled": true,
            "wiki_enabled": false,
            "jobs_enabled": true,
            "snippets_enabled": true,
            "can_create_merge_request_in": true,
            "issues_access_level": "enabled",
            "repository_access_level": "enabled",
            "merge_requests_access_level": "enabled",
            "wiki_access_level": "disabled",
            "builds_access_level": "enabled",
            "snippets_access_level": "enabled",
            "pages_access_level": "enabled",
            "emails_disabled": false,
            "shared_runners_enabled": true,
            "lfs_enabled": true,
            "creator_id": 5497,
            "import_status": "finished",
            "open_issues_count": 25238,
            "ci_default_git_depth": null,
            "public_jobs": true,
            "build_timeout": 7680,
            "auto_cancel_pending_pipelines": "enabled",
            "build_coverage_regex": "",
            "ci_config_path": "",
            "shared_with_groups": [
                {
                    "group_id": 3205033,
                    "group_name": "gl-quality",
                    "group_full_path": "gl-quality",
                    "group_access_level": 30,
                    "expires_at": null
                },
                {
                    "group_id": 6150316,
                    "group_name": "frontend",
                    "group_full_path": "gitlab-org/maintainers/frontend",
                    "group_access_level": 30,
                    "expires_at": null
                },
                {
                    "group_id": 1356356,
                    "group_name": "GitLab docs team",
                    "group_full_path": "gl-docsteam",
                    "group_access_level": 30,
                    "expires_at": null
                },
                {
                    "group_id": 5924764,
                    "group_name": "database",
                    "group_full_path": "gitlab-org/maintainers/database",
                    "group_access_level": 30,
                    "expires_at": null
                },
                {
                    "group_id": 5747833,
                    "group_name": "eng-prod",
                    "group_full_path": "gl-quality/eng-prod",
                    "group_access_level": 30,
                    "expires_at": null
                },
                {
                    "group_id": 3887968,
                    "group_name": "rails-backend",
                    "group_full_path": "gitlab-org/maintainers/rails-backend",
                    "group_access_level": 40,
                    "expires_at": null
                },
                {
                    "group_id": 2584649,
                    "group_name": "managers",
                    "group_full_path": "gitlab-org/release/managers",
                    "group_access_level": 40,
                    "expires_at": null
                }
            ],
            "only_allow_merge_if_pipeline_succeeds": false,
            "request_access_enabled": false,
            "only_allow_merge_if_all_discussions_are_resolved": true,
            "remove_source_branch_after_merge": true,
            "printing_merge_request_link_enabled": true,
            "merge_method": "merge",
            "suggestion_commit_message": "",
            "auto_devops_enabled": false,
            "auto_devops_deploy_strategy": "continuous",
            "autoclose_referenced_issues": true,
            "approvals_before_merge": 1,
            "mirror": false,
            "external_authorization_classification_label": "",
            "packages_enabled": false,
            "service_desk_enabled": false,
            "service_desk_address": null,
            "marked_for_deletion_at": null
        }
    ],
    "shared_runners_minutes_limit": null,
    "extra_shared_runners_minutes_limit": null
}

その他

ResourceAvailable endpoints
Access requests/groups/:id/access_requests/ (also available for projects)
Custom attributes/groups/:id/custom_attributes (also available for projects and users)
Discussions (threaded comments) /groups/:id/epics/.../discussions (also available for projects)
Epic issues /groups/:id/epics/.../issues
Epic links /groups/:id/epics/.../epics
Epics /groups/:id/epics
Groups/groups/groups/.../subgroups
Group badges/groups/:id/badges
Group issue boards/groups/:id/boards
Group labels/groups/:id/labels
Group-level variables/groups/:id/variables
Group milestones/groups/:id/milestones
Issues/groups/:id/issues (also available for projects and standalone)
Issues Statistics/groups/:id/issues_statistics (also available for projects and standalone)
Members/groups/:id/members (also available for projects)
Merge requests/groups/:id/merge_requests (also available for projects and standalone)
Notes (comments)/groups/:id/epics/.../notes (also available for projects)
Notification settings/groups/:id/notification_settings (also available for projects and standalone)
Resource label events/groups/:id/epics/.../resource_label_events (also available for projects)
Search/groups/:id/search (also available for projects and standalone)

ユーザの取得

ユーザ一覧

リクエスト

/api/v4/users?per_page=3&page=1

レスポンス

[
    {
        "id": 5409901,
        "name": "Jayaprakash Bhimineni",
        "username": "jpbeemineni",
        "state": "active",
        "avatar_url": "https://secure.gravatar.com/avatar/a76089e1fbbaf0976f1e3586059647d6?s=80\u0026d=identicon",
        "web_url": "https://gitlab.com/jpbeemineni"
    },
    {
        "id": 5409900,
        "name": "Riccardo De Cristofaris",
        "username": "r.decristofaris",
        "state": "active",
        "avatar_url": "https://secure.gravatar.com/avatar/1738cf9ef394d21e0c529b21508b7525?s=80\u0026d=identicon",
        "web_url": "https://gitlab.com/r.decristofaris"
    },
    {
        "id": 5409899,
        "name": "Lars van den Hazel",
        "username": "Larshazel",
        "state": "active",
        "avatar_url": "https://secure.gravatar.com/avatar/2bcc5d9bea0164bcc464c36ca7d8b525?s=80\u0026d=identicon",
        "web_url": "https://gitlab.com/Larshazel"
    }
]

ユーザ詳細

リクエスト

/api/v4/users/:id
(例: /api/v4/users/4206326)

レスポンス

{
    "id": 4206326,
    "name": "Yoshiki Shinagawa",
    "username": "s-yoshiki",
    "state": "active",
    "avatar_url": "https://secure.gravatar.com/avatar/9e9fac1555b78c6c94e46bf99741f5f1?s=80\u0026d=identicon",
    "web_url": "https://gitlab.com/s-yoshiki",
    "created_at": "2019-06-27T02:22:35.354Z",
    "bio": null,
    "location": null,
    "public_email": "",
    "skype": "",
    "linkedin": "",
    "twitter": "",
    "website_url": "",
    "organization": null
}

その他、独立したAPI

ResourceAvailable endpoints
Appearance /application/appearance
Applications/applications
Audit Events /audit_events
Avatar/avatar
Broadcast messages/broadcast_messages
Code snippets/snippets
Custom attributes/users/:id/custom_attributes (also available for groups and projects)
Deploy keys/deploy_keys (also available for projects)
Events/events/users/:id/events (also available for projects)
Feature flags/features
Geo Nodes /geo_nodes
Import repository from GitHub/import/github
Issues/issues (also available for groups and projects)
Issues Statistics/issues_statistics (also available for groups and projects)
Keys/keys
License /license
Markdown/markdown
Merge requests/merge_requests (also available for groups and projects)
Namespaces/namespaces
Notification settings/notification_settings (also available for groups and projects)
Pages domains/pages/domains (also available for projects)
Projects/users/:id/projects (also available for projects)
Runners/runners (also available for projects)
Search/search (also available for groups and projects)
Settings/application/settings
Statistics/application/statistics
Sidekiq metrics/sidekiq
Suggestions/suggestions
System hooks/hooks
Todos/todos
Users/users
Validate .gitlab-ci.yml file/lint
Version/version
Git Web & Programming
スポンサーリンク
スポンサーリンク
スポンサーリンク
404 Motivation Not Found
タイトルとURLをコピーしました