正式なドキュメントは英語版であり、この日本語訳はAI支援翻訳により作成された参考用のものです。日本語訳の一部の内容は人間によるレビューがまだ行われていないため、翻訳のタイミングにより英語版との間に差異が生じることがあります。最新かつ正確な情報については、英語版をご参照ください。

ダイレクトトランスファーAPIによるグループおよびプロジェクトの移行

  • プラン: Free、Premium、Ultimate
  • 提供形態: GitLab.com、GitLab Self-Managed、GitLab Dedicated

このAPIを使用して、ダイレクト転送でグループとプロジェクトを移行します。

前提要件

ダイレクトトランスファーAPIによるグループ移行の前提条件については、ダイレクトトランスファーによるグループ移行の前提条件を参照してください。

新しいグループまたはプロジェクト移行を開始する

このエンドポイントを使用して、新しいグループまたはプロジェクト移行を開始します。プロジェクトを移行するには、entities[project_entity]を指定します。

POST /bulk_imports
属性必須説明
configurationハッシュはいソースGitLabインスタンスの設定。
configuration[url]文字列はいソースGitLabインスタンスのURL。
configuration[access_token]文字列はいソースGitLabインスタンスへのアクセストークン。
entities配列はいインポートするエンティティのリスト。
entities[source_type]文字列はいソースエンティティタイプ。有効な値はgroup_entityproject_entityです。
entities[source_full_path]文字列はいインポートするエンティティのソースのパス。たとえばgitlab-org/gitlabなどです。
entities[destination_slug]文字列はいエンティティの宛先slug。GitLabは、エンティティへのURLパスとしてslugを使用します。インポートされたエンティティの名前は、slugではなく、ソースエンティティの名前からコピーされます。
entities[destination_namespace]文字列はいエンティティの宛先グループネームスペースのフルパス。project_entityの場合、この値は、宛先インスタンス上の既存のグループである必要があります。group_entityの場合、この値は、宛先インスタンス上の既存のグループであるか、宛先インスタンスにトップレベルグループを作成するための空の文字列""(GitLab DedicatedおよびGitLabセルフマネージドの場合)です。個人のネームスペースはサポートされていません。
entities[destination_name]文字列いいえ非推奨: 代わりにdestination_slugを使用してください。エンティティの宛先slug。
entities[migrate_memberships]ブール値いいえユーザーメンバーシップをインポートします。trueがデフォルトです。
entities[migrate_projects]ブール値いいえグループのネストされたすべてのプロジェクトもインポートします(source_typegroup_entityの場合)。trueがデフォルトです。
curl --request POST \
  --url "https://destination-gitlab-instance.example.com/api/v4/bulk_imports" \
  --header "PRIVATE-TOKEN: <your_access_token_for_destination_gitlab_instance>" \
  --header "Content-Type: application/json" \
  --data '{
    "configuration": {
      "url": "https://source-gitlab-instance.example.com",
      "access_token": "<your_access_token_for_source_gitlab_instance>"
    },
    "entities": [
      {
        "source_full_path": "source/full/path",
        "source_type": "group_entity",
        "destination_slug": "destination_slug",
        "destination_namespace": "destination/namespace/path"
      }
    ]
  }'
{
  "id": 1,
  "status": "created",
  "source_type": "gitlab",
  "source_url": "https://gitlab.example.com",
  "created_at": "2021-06-18T09:45:55.358Z",
  "updated_at": "2021-06-18T09:46:27.003Z",
  "has_failures": false
}

すべてのグループまたはプロジェクト移行を一覧表示する

GET /bulk_imports
属性必須説明
per_page整数いいえページごとに返すレコード数。
page整数いいえ取得するページ。
sort文字列いいえ作成日でascまたはdescの順にソートされたレコードを返します。デフォルトはdescです。
status文字列いいえインポートステータス。

ステータスは、次のいずれかになります:

  • created
  • started
  • finished
  • failed
curl --request GET \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/bulk_imports?per_page=2&page=1"
[
    {
        "id": 1,
        "status": "finished",
        "source_type": "gitlab",
        "source_url": "https://gitlab.example.com",
        "created_at": "2021-06-18T09:45:55.358Z",
        "updated_at": "2021-06-18T09:46:27.003Z",
        "has_failures": false
    },
    {
        "id": 2,
        "status": "started",
        "source_type": "gitlab",
        "source_url": "https://gitlab.example.com",
        "created_at": "2021-06-18T09:47:36.581Z",
        "updated_at": "2021-06-18T09:47:58.286Z",
        "has_failures": false
    }
]

すべてのグループまたはプロジェクト移行のエンティティを一覧表示する

GET /bulk_imports/entities
属性必須説明
per_page整数いいえページごとに返すレコード数。
page整数いいえ取得するページ。
sort文字列いいえ作成日でascまたはdescの順にソートされたレコードを返します。デフォルトはdescです。
status文字列いいえインポートステータス。

ステータスは、次のいずれかになります:

  • created
  • started
  • finished
  • failed
curl --request GET \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/bulk_imports/entities?per_page=2&page=1&status=started"
[
    {
        "id": 1,
        "bulk_import_id": 1,
        "status": "finished",
        "entity_type": "group",
        "source_full_path": "source_group",
        "destination_full_path": "destination/full_path",
        "destination_name": "destination_slug",
        "destination_slug": "destination_slug",
        "destination_namespace": "destination_path",
        "parent_id": null,
        "namespace_id": 1,
        "project_id": null,
        "created_at": "2021-06-18T09:47:37.390Z",
        "updated_at": "2021-06-18T09:47:51.867Z",
        "failures": [],
        "migrate_projects": true,
        "migrate_memberships": true,
        "has_failures": false,
        "stats": {
            "labels": {
                "source": 10,
                "fetched": 10,
                "imported": 10
            },
            "milestones": {
                "source": 10,
                "fetched": 10,
                "imported": 10
            }
        }
    },
    {
        "id": 2,
        "bulk_import_id": 2,
        "status": "failed",
        "entity_type": "group",
        "source_full_path": "another_group",
        "destination_full_path": "destination/full_path",
        "destination_name": "destination_slug",
        "destination_slug": "another_slug",
        "destination_namespace": "another_namespace",
        "parent_id": null,
        "namespace_id": null,
        "project_id": null,
        "created_at": "2021-06-24T10:40:20.110Z",
        "updated_at": "2021-06-24T10:40:46.590Z",
        "failures": [
            {
                "relation": "group",
                "step": "extractor",
                "exception_message": "Error!",
                "exception_class": "Exception",
                "correlation_id_value": "dfcf583058ed4508e4c7c617bd7f0edd",
                "created_at": "2021-06-24T10:40:46.495Z",
                "pipeline_class": "BulkImports::Groups::Pipelines::GroupPipeline",
                "pipeline_step": "extractor"
            }
        ],
        "migrate_projects": true,
        "migrate_memberships": true,
        "has_failures": false,
        "stats": { }
    }
]

グループまたはプロジェクト移行の詳細を取得する

GET /bulk_imports/:id
curl --request GET \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/bulk_imports/1"
{
  "id": 1,
  "status": "finished",
  "source_type": "gitlab",
  "source_url": "https://gitlab.example.com",
  "created_at": "2021-06-18T09:45:55.358Z",
  "updated_at": "2021-06-18T09:46:27.003Z"
}

グループまたはプロジェクト移行エンティティを一覧表示する

GET /bulk_imports/:id/entities
属性必須説明
per_page整数いいえページごとに返すレコード数。
page整数いいえ取得するページ。
sort文字列いいえ作成日でascまたはdescの順にソートされたレコードを返します。デフォルトはdescです。
status文字列いいえインポートステータス。

ステータスは、次のいずれかになります:

  • created
  • started
  • finished
  • failed
curl --request GET \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/bulk_imports/1/entities?per_page=2&page=1&status=finished"
[
    {
        "id": 1,
        "bulk_import_id": 1,
        "status": "finished",
        "entity_type": "group",
        "source_full_path": "source_group",
        "destination_full_path": "destination/full_path",
        "destination_name": "destination_slug",
        "destination_slug": "destination_slug",
        "destination_namespace": "destination_path",
        "parent_id": null,
        "namespace_id": 1,
        "project_id": null,
        "created_at": "2021-06-18T09:47:37.390Z",
        "updated_at": "2021-06-18T09:47:51.867Z",
        "failures": [
            {
                "relation": "group",
                "step": "extractor",
                "exception_message": "Error!",
                "exception_class": "Exception",
                "correlation_id_value": "dfcf583058ed4508e4c7c617bd7f0edd",
                "created_at": "2021-06-24T10:40:46.495Z",
                "pipeline_class": "BulkImports::Groups::Pipelines::GroupPipeline",
                "pipeline_step": "extractor"
            }
        ],
        "migrate_projects": true,
        "migrate_memberships": true,
        "has_failures": true,
        "stats": {
            "labels": {
                "source": 10,
                "fetched": 10,
                "imported": 10
            },
            "milestones": {
                "source": 10,
                "fetched": 10,
                "imported": 10
            }
        }
    }
]

グループまたはプロジェクト移行エンティティの詳細を取得する

GET /bulk_imports/:id/entities/:entity_id
curl --request GET \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/bulk_imports/1/entities/2"
{
    "id": 1,
    "bulk_import_id": 1,
    "status": "finished",
    "entity_type": "group",
    "source_full_path": "source_group",
    "destination_full_path": "destination/full_path",
    "destination_name": "destination_slug",
    "destination_slug": "destination_slug",
    "destination_namespace": "destination_path",
    "parent_id": null,
    "namespace_id": 1,
    "project_id": null,
    "created_at": "2021-06-18T09:47:37.390Z",
    "updated_at": "2021-06-18T09:47:51.867Z",
    "failures": [
        {
            "relation": "group",
            "step": "extractor",
            "exception_message": "Error!",
            "exception_class": "Exception",
            "correlation_id_value": "dfcf583058ed4508e4c7c617bd7f0edd",
            "created_at": "2021-06-24T10:40:46.495Z",
            "pipeline_class": "BulkImports::Groups::Pipelines::GroupPipeline",
            "pipeline_step": "extractor"
        }
    ],
    "migrate_projects": true,
    "migrate_memberships": true,
    "has_failures": true,
    "stats": {
        "labels": {
            "source": 10,
            "fetched": 10,
            "imported": 10
        },
        "milestones": {
            "source": 10,
            "fetched": 10,
            "imported": 10
        }
    }
}

グループまたはプロジェクト移行エンティティの失敗したインポートレコードのリストを取得する

GET /bulk_imports/:id/entities/:entity_id/failures
curl --request GET \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/bulk_imports/1/entities/2/failures"
{
  "relation": "issues",
  "exception_message": "Error!",
  "exception_class": "StandardError",
  "correlation_id_value": "06289e4b064329a69de7bb2d7a1b5a97",
  "source_url": "https://gitlab.example/project/full/path/-/issues/1",
  "source_title": "Issue title"
}

移行をキャンセルする

ダイレクトトランスファー移行をキャンセルします。

POST /bulk_imports/:id/cancel
curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/bulk_imports/1/cancel"
{
  "id": 1,
  "status": "canceled",
  "source_type": "gitlab",
  "created_at": "2021-06-18T09:45:55.358Z",
  "updated_at": "2021-06-18T09:46:27.003Z",
  "has_failures": false
}

返される可能性のある応答のステータスコードは次のとおりです:

ステータス説明
200移行は正常にキャンセルされました
401認証されていません
403禁止されています
404移行が見つかりません
503サービスは利用できません