debian-mirror-gitlab/doc/api/bulk_imports.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

259 lines
9.1 KiB
Markdown
Raw Normal View History

2021-09-30 23:02:18 +05:30
---
stage: Manage
2023-07-09 08:55:56 +05:30
group: Import and Integrate
2022-11-25 23:54:43 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2021-09-30 23:02:18 +05:30
---
2023-06-20 00:43:36 +05:30
# Group and project migration by direct transfer API **(FREE)**
2021-09-30 23:02:18 +05:30
2023-06-20 00:43:36 +05:30
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64335) in GitLab 14.1.
> - Project migration [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/390515) in GitLab 15.11.
2021-09-30 23:02:18 +05:30
2023-04-23 21:23:45 +05:30
With the group migration by direct transfer API, you can start and view the progress of migrations initiated with
[group migration by direct transfer](../user/group/import/index.md#migrate-groups-by-direct-transfer-recommended).
2021-09-30 23:02:18 +05:30
2023-07-09 08:55:56 +05:30
WARNING:
Migrating projects with this API is in [Beta](../policy/alpha-beta-support.md#beta). This feature is not
ready for production use.
2023-06-20 00:43:36 +05:30
## Prerequisites
2021-10-27 15:23:28 +05:30
2023-06-20 00:43:36 +05:30
For information on prerequisites for group migration by direct transfer API, see
prerequisites for [migrating groups by direct transfer](../user/group/import/index.md#prerequisites).
## Start a new group or project migration
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66353) in GitLab 14.2.
> - `project_entity` source type [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/390515) in GitLab 15.11.
Use this endpoint to start a new group or project migration. Specify:
- `entities[group_entity]` to migrate a group.
2023-07-09 08:55:56 +05:30
- `entities[project_entity]` to migrate a project (Beta).
2021-10-27 15:23:28 +05:30
```plaintext
POST /bulk_imports
```
| Attribute | Type | Required | Description |
| --------------------------------- | ------ | -------- | ----------- |
| `configuration` | Hash | yes | The source GitLab instance configuration. |
| `configuration[url]` | String | yes | Source GitLab instance URL. |
| `configuration[access_token]` | String | yes | Access token to the source GitLab instance. |
| `entities` | Array | yes | List of entities to import. |
2023-06-20 00:43:36 +05:30
| `entities[source_type]` | String | yes | Source entity type. Valid values are `group_entity` (GitLab 14.2 and later) and `project_entity` (GitLab 15.11 and later). |
2021-10-27 15:23:28 +05:30
| `entities[source_full_path]` | String | yes | Source full path of the entity to import. |
2022-08-27 11:52:29 +05:30
| `entities[destination_name]` | String | yes | Deprecated: Use :destination_slug instead. Destination slug for the entity. |
| `entities[destination_slug]` | String | yes | Destination slug for the entity. |
2023-03-04 22:38:38 +05:30
| `entities[destination_namespace]` | String | yes | Destination namespace for the entity. |
2021-10-27 15:23:28 +05:30
```shell
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/bulk_imports" \
2023-03-04 22:38:38 +05:30
--header "Content-Type: application/json" \
2021-10-27 15:23:28 +05:30
--data '{
"configuration": {
"url": "http://gitlab.example/",
"access_token": "access_token"
},
"entities": [
{
"source_full_path": "source/full/path",
"source_type": "group_entity",
2022-08-27 11:52:29 +05:30
"destination_slug": "destination_slug",
2021-10-27 15:23:28 +05:30
"destination_namespace": "destination/namespace/path"
}
]
}'
```
```json
{ "id": 1, "status": "created", "source_type": "gitlab", "created_at": "2021-06-18T09:45:55.358Z", "updated_at": "2021-06-18T09:46:27.003Z" }
```
2023-06-20 00:43:36 +05:30
## List all group or project migrations
2021-09-30 23:02:18 +05:30
```plaintext
GET /bulk_imports
```
2023-06-20 00:43:36 +05:30
| Attribute | Type | Required | Description |
|:-----------|:--------|:---------|:-----------------------------------------------------------------------------------|
| `per_page` | integer | no | Number of records to return per page. |
| `page` | integer | no | Page to retrieve. |
| `sort` | string | no | Return records sorted in `asc` or `desc` order by creation date. Default is `desc` |
| `status` | string | no | Import status. |
2021-09-30 23:02:18 +05:30
The status can be one of the following:
- `created`
- `started`
- `finished`
- `failed`
```shell
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/bulk_imports?per_page=2&page=1"
```
```json
[
{
"id": 1,
"status": "finished",
"source_type": "gitlab",
"created_at": "2021-06-18T09:45:55.358Z",
"updated_at": "2021-06-18T09:46:27.003Z"
},
{
"id": 2,
"status": "started",
"source_type": "gitlab",
"created_at": "2021-06-18T09:47:36.581Z",
"updated_at": "2021-06-18T09:47:58.286Z"
}
]
```
2023-06-20 00:43:36 +05:30
## List all group or project migrations' entities
2021-09-30 23:02:18 +05:30
```plaintext
GET /bulk_imports/entities
```
2023-06-20 00:43:36 +05:30
| Attribute | Type | Required | Description |
|:-----------|:--------|:---------|:-----------------------------------------------------------------------------------|
| `per_page` | integer | no | Number of records to return per page. |
| `page` | integer | no | Page to retrieve. |
| `sort` | string | no | Return records sorted in `asc` or `desc` order by creation date. Default is `desc` |
| `status` | string | no | Import status. |
2021-09-30 23:02:18 +05:30
The status can be one of the following:
- `created`
- `started`
- `finished`
- `failed`
```shell
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/bulk_imports/entities?per_page=2&page=1&status=started"
```
```json
[
{
"id": 1,
"bulk_import_id": 1,
"status": "finished",
"source_full_path": "source_group",
2022-08-27 11:52:29 +05:30
"destination_slug": "destination_slug",
2021-09-30 23:02:18 +05:30
"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": []
},
{
"id": 2,
"bulk_import_id": 2,
"status": "failed",
"source_full_path": "another_group",
2022-08-27 11:52:29 +05:30
"destination_slug": "another_slug",
2021-09-30 23:02:18 +05:30
"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": [
{
2022-11-25 23:54:43 +05:30
"relation": "group",
"step": "extractor",
"exception_message": "Error!",
2021-09-30 23:02:18 +05:30
"exception_class": "Exception",
"correlation_id_value": "dfcf583058ed4508e4c7c617bd7f0edd",
2022-11-25 23:54:43 +05:30
"created_at": "2021-06-24T10:40:46.495Z",
"pipeline_class": "BulkImports::Groups::Pipelines::GroupPipeline",
"pipeline_step": "extractor"
2021-09-30 23:02:18 +05:30
}
]
}
]
```
2023-06-20 00:43:36 +05:30
## Get group or project migration details
2021-09-30 23:02:18 +05:30
```plaintext
GET /bulk_imports/:id
```
```shell
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/bulk_imports/1"
```
```json
{
"id": 1,
"status": "finished",
"source_type": "gitlab",
"created_at": "2021-06-18T09:45:55.358Z",
"updated_at": "2021-06-18T09:46:27.003Z"
}
```
2023-06-20 00:43:36 +05:30
## List group or project migration entities
2021-09-30 23:02:18 +05:30
```plaintext
GET /bulk_imports/:id/entities
```
2023-06-20 00:43:36 +05:30
| Attribute | Type | Required | Description |
|:-----------|:--------|:---------|:-----------------------------------------------------------------------------------|
| `per_page` | integer | no | Number of records to return per page. |
| `page` | integer | no | Page to retrieve. |
| `sort` | string | no | Return records sorted in `asc` or `desc` order by creation date. Default is `desc` |
| `status` | string | no | Import status. |
2021-09-30 23:02:18 +05:30
The status can be one of the following:
- `created`
- `started`
- `finished`
- `failed`
```shell
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/bulk_imports/1/entities?per_page=2&page=1&status=finished"
```
```json
[
{
"id": 1,
"status": "finished",
"source_type": "gitlab",
"created_at": "2021-06-18T09:45:55.358Z",
"updated_at": "2021-06-18T09:46:27.003Z"
}
]
```
2023-06-20 00:43:36 +05:30
## Get group or project migration entity details
2021-09-30 23:02:18 +05:30
```plaintext
GET /bulk_imports/:id/entities/:entity_id
```
```shell
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/bulk_imports/1/entities/2"
```
```json
{
"id": 1,
"status": "finished",
"source_type": "gitlab",
"created_at": "2021-06-18T09:45:55.358Z",
"updated_at": "2021-06-18T09:46:27.003Z"
}
```