REST API 一次在gitlab中创建多个组

REST API to create multiple groups in gitlab at once

我已经安装了 GitLab EE (11.4.7-ee)。我正在尝试使用 REST API.

创建 mulitplr 组
https://testserver/gitlab/api/v4/groups

Post数据:

[
    { "name": "test1", "path": "test1" },
    { "name": "test2", "path": "test2" },
    { "name": "test3", "path": "test3" }
    ]

错误信息:

{ "error": "name is missing, path is missing" }

How to create many groups in one GitLab Group create Rest API

我写了 [=13th=] 脚本在 gitlab 中创建多个组

import requests
import json
import urllib3

with open('./jfmjson.json', 'r') as f:
    jfm_dict = json.load(f)

for jfm in jfm_dict:
    print(jfm['path'])
    gitlab_url = "https://testserver/gitlab/api/v4/groups"
    headers = {'Content-type': 'application/json', 'PRIVATE-TOKEN': 'pxpR3sehJ-xYzz61XxAs'}
    data = {'name': jfm['path'], 'path': jfm['path'], 'description': jfm['name']}
    urllib3.disable_warnings()
    r = requests.post(gitlab_url, data=json.dumps(data), headers=headers, verify=False)