{{< details >}}

  • Tier: 基础版,专业版,旗舰版
  • Offering: JihuLab.com,私有化部署

{{< /details >}}

{{< history >}}

  • 在极狐GitLab 15.8 中引入了新的应用设置 bulk_import_enabledbulk_import 功能标志被移除。

{{< /history >}}

项目关系导出 API 将项目的结构部分导出为每个顶级关系(例如,里程碑、议题和标签)的单独文件。

项目关系导出 API 主要用于群组迁移,不能与项目导入和导出 API一起使用。

计划新的导出

启动新的项目关系导出:

POST /projects/:id/export_relations
属性 类型 必需 描述
id integer/string 项目的 ID。
batched boolean 是否分批导出。
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/export_relations"
{
  "message": "202 Accepted"
}

导出状态

查看关系导出的状态:

GET /projects/:id/export_relations/status
属性 类型 必需 描述
id integer/string 项目的 ID。
relation string 要查看的项目顶级关系的名称。
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" \
     "https://gitlab.example.com/api/v4/projects/1/export_relations/status"

状态可以是以下之一:

  • 0 - started
  • 1 - finished
  • -1 - failed
[
  {
    "relation": "project_badges",
    "status": 1,
    "error": null,
    "updated_at": "2021-05-04T11:25:20.423Z",
    "batched": true,
    "batches_count": 1,
    "batches": [
      {
        "status": 1,
        "batch_number": 1,
        "objects_count": 1,
        "error": null,
        "updated_at": "2021-05-04T11:25:20.423Z"
      }
    ]
  },
  {
    "relation": "boards",
    "status": 1,
    "error": null,
    "updated_at": "2021-05-04T11:25:20.085Z",
    "batched": false,
    "batches_count": 0
  }
]

导出下载

下载已完成的关系导出:

GET /projects/:id/export_relations/download
属性 类型 必需 描述
id integer/string 项目的 ID。
relation string 要下载的项目顶级关系的名称。
batched boolean 导出是否分批。
batch_number integer 要下载的导出批次编号。
curl --header "PRIVATE-TOKEN: <your_access_token>" --remote-header-name \
     --remote-name "https://gitlab.example.com/api/v4/projects/1/export_relations/download?relation=labels"
ls labels.ndjson.gz
labels.ndjson.gz

相关主题