项目管理导出 API

  • Tier: 基础版,专业版,旗舰版
  • Offering: JihuLab.com,私有化部署
History
    • 在极狐GitLab 15.8 中引入了新的应用设置 bulk_import_enabledbulk_import 功能标志被移除。

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

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

计划新的导出#

启动新的项目关系导出:

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

导出状态#

查看关系导出的状态:

plaintext
GET /projects/:id/export_relations/status
属性类型必需描述
idinteger/string项目的 ID。
relationstring要查看的项目顶级关系的名称。
shell
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
json
1[ 2 { 3 "relation": "project_badges", 4 "status": 1, 5 "error": null, 6 "updated_at": "2021-05-04T11:25:20.423Z", 7 "batched": true, 8 "batches_count": 1, 9 "batches": [ 10 { 11 "status": 1, 12 "batch_number": 1, 13 "objects_count": 1, 14 "error": null, 15 "updated_at": "2021-05-04T11:25:20.423Z" 16 } 17 ] 18 }, 19 { 20 "relation": "boards", 21 "status": 1, 22 "error": null, 23 "updated_at": "2021-05-04T11:25:20.085Z", 24 "batched": false, 25 "batches_count": 0 26 } 27]

导出下载#

下载已完成的关系导出:

plaintext
GET /projects/:id/export_relations/download
属性类型必需描述
idinteger/string项目的 ID。
relationstring要下载的项目顶级关系的名称。
batchedboolean导出是否分批。
batch_numberinteger要下载的导出批次编号。
shell
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"
shell
ls labels.ndjson.gz labels.ndjson.gz