项目管理导出 API
- Tier: 基础版,专业版,旗舰版
- Offering: JihuLab.com,私有化部署
History
- 在极狐GitLab 15.8 中引入了新的应用设置 bulk_import_enabled。bulk_import 功能标志被移除。
项目关系导出 API 将项目的结构部分导出为每个顶级关系(例如,里程碑、议题和标签)的单独文件。
项目关系导出 API 主要用于群组迁移,不能与项目导入和导出 API一起使用。
计划新的导出
启动新的项目关系导出:
plaintextPOST /projects/:id/export_relations
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的 ID。 |
| batched | boolean | 否 | 是否分批导出。 |
shellcurl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/export_relations"
json{ "message": "202 Accepted" }
导出状态
查看关系导出的状态:
plaintextGET /projects/:id/export_relations/status
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的 ID。 |
| relation | string | 否 | 要查看的项目顶级关系的名称。 |
shellcurl --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
json1[ 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]
导出下载
下载已完成的关系导出:
plaintextGET /projects/:id/export_relations/download
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的 ID。 |
| relation | string | 是 | 要下载的项目顶级关系的名称。 |
| batched | boolean | 否 | 导出是否分批。 |
| batch_number | integer | 否 | 要下载的导出批次编号。 |
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" --remote-header-name \ --remote-name "https://gitlab.example.com/api/v4/projects/1/export_relations/download?relation=labels"
shellls labels.ndjson.gz labels.ndjson.gz