GitLab API の 簡単な使い方

2020-02-10
gitgitlabapi
    

目次

概要

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

原則:アクセストークン

https://docs.gitlab.com/ee/api/#personal-access-tokens

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

原則:ページネーション

https://docs.gitlab.com/ee/api/#pagination

大量のデータを送らないようにページネーションの仕組みがあります。 ページ番号を指定するパラメータ"page"とページのアイテム数の上限を指定する"perpage"があります。perpageの上限は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: <https://gitlab.example.com/api/v4/projects/8/issues/8/notes?page=1&per_page=3>; rel="prev", <https://gitlab.example.com/api/v4/projects/8/issues/8/notes?page=3&per_page=3>; rel="next", <https://gitlab.example.com/api/v4/projects/8/issues/8/notes?page=1&per_page=3>; rel="first", <https://gitlab.example.com/api/v4/projects/8/issues/8/notes?page=3&per_page=3>; 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
Projectsincluding 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
}

その他

Resource Available 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

Resource Available 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.ymlfile /lint
Version /version
    
s-yoshiki
s-yoshiki
githubtwitterqiita
Web作ってますが、インタラクティブなプログラミングも好きです。
JavaScript / Vue / node.js / PHP / AWS / OpenCV

関連記事

GitHubのリポジトリをGitLabに同期する GitLabのミラーリング機能
GitLabのミラーリングについて GitHubのリポジトリをGitLabに反映する その他 参考 GitLabのミラーリング機能によりGitHubなどの外部のリポジトリとのミラーリングを行うことができます。 これを使ってGitHub…

Gitの初心者向け入門資料を集めてみた
バージョン管理システムとして利用される事が多いGitですが、初心者には意外とハードルが高かったりするため、初心者向け入門資料を集めてみました。 Git入門資料 https://gist.github.com/s-yoshiki/3ef9bfde7c0b…

GitHub の CONTRIBUTING には何を書けばいいのか?
はじめに サンプル js-primer 参考 はじめに GitHubのOSSプロジェクトを見ているとリポジトリのルート直下に存在する CONTRIBUTING.md というファイルをよく目にします。 これは、OSS…

gitbookで使えそうなプラグインを集めて見た
の折りたたみ - expand-active-chapter インストール 設定 参考 コードハイライト - gitbook-plugin-prism インストール 参考 ツリービュー インストール 設定 参考 UML - gitbook-plugin-uml…

gitbookを使ってドキュメントを生成する
どんなものができるのか 検証した環境 gitbookのインストール プロジェクトの作成 ディレクトリ構成について ドキュメントの記述 日本語化 ビルドインサーバの起動 ビルドとHTMLの生成 PDFの生成 参考 GitBook…

Proxy環境下で快適に作業する設定メモ
対象環境 Linux / Unix 環境 + WSL環境 bash / zsh curl wget apt Git 社内Proxy…

最新の投稿

GitHub Actions で Gatsby をビルドし Amazon S3 にデプロイする
GitHub Actions について あらかじめ準備しておくもの AWS IAM ユーザを環境変数にセットする workflowの記述 ビルド バッジを利用する 終わりに 参考にしたところ Gatsbyで作った静的サイトを、GitHub Actions…

cloudinaryによる画像ファイルの管理 はじめてみる
目的 cloudinary について 他のサービスとの比較 料金プラン アカウントの登録 利用してみる ダッシュボード 画像の編集 APIベースでのアクセス 感想 参考 画像の管理や配信、さらには加工といった事ができるsaas型のcloud…

JavaScriptによる2分探索(バイナリサーチ) のサンプルコード
2分探索について ソース 参考 JavaScriptで2分探索(バイナリサーチ)を実装してみました。…

Vue.jsで作成された、ちょっと面白くて役立ちそうなサービス
UIコンポーネント VueSocial CKEditor 5 Vue.Draggable Vuetable 2 vuejs-datepicker Kalendar Vue Apexcharts Vue.js Google Charts vue-cart WebIDE…

GitHubのリポジトリをGitLabに同期する GitLabのミラーリング機能
GitLabのミラーリングについて GitHubのリポジトリをGitLabに反映する その他 参考 GitLabのミラーリング機能によりGitHubなどの外部のリポジトリとのミラーリングを行うことができます。 これを使ってGitHub…

WordPressやめます Gatsbyに移行しました
これまでのWordPress運用 なぜWordPressを捨てるのか? なぜGatsbyを利用するのか? gatsbyについて WordPressから記事の救出 移行対象記事の抽出 記事の置換 Gatsbyテーマの作成 Gatsby…

WordPressのDBから記事データを抽出する
WordPressのDB関連図 公開記事一覧の取得 タグ・カテゴリの取得 サムネイルの取得 おまけ: PHPスクリプト化しました 参考にしたところ WordPressにため込んだデータMarkdown化しGatsby…

ハイフンとかマイナスとかダッシュとか

Firebase + Nuxt で認証付きページを作るときに参考にしたいところ
Webアプリケーションのセッション管理にJWT導入を検討する際の考え方 Service Worker によるセッション管理 ユーザー セッションの管理 Nuxt.jsとFirebaseでSPA×SSR×PWA×サーバーレスを実現する CookieとセッションとJWT SSR…

GolangをCGIとして実行する
環境 golang パッケージ ソースと実行 ビルドとサーバ実行 標準ライブラリのみ Golang を CGIとして実行する際のメモ 環境 golang パッケージ 以下のモジュールを利用しています。 github.com/gorilla/mux…

Tags

Dates

© 2020   404 motivation not found