官方api 文档: https://s0docs0gitlab0com.icopy.site/ee/api/api_resources.html
token=D3ro1i76p9FLDE3sQxdg
url=http://10.1.6.161/
# 获取组的详细信息
group_name="myg2"
curl --header "PRIVATE-TOKEN: ${token}" ${url}/api/v4/groups/${group_name}
# 添加一个组
add_group_name="ylbAdd"
curl --request POST --header "PRIVATE-TOKEN: ${token}" --data "name=${add_group_name}&path=${add_group_name}" ${url}/api/v4/groups;
# 添加一个子组
sub_group_name="yy1"
parent_id=254
curl --request POST --header "PRIVATE-TOKEN: ${token}" --data "name=${sub_group_name}&path=${sub_group_name}&parent_id=${parent_id}" ${url}/api/v4/groups;
# members: https://docs.gitlab.com/ee/api/members.html
# 或取组中的成员
group_id=254
curl --header "PRIVATE-TOKEN: ${token}" "${url}/api/v4/groups/${group_id}/members"
# 将用户添加到组中
user_id=157
group_id=254
access_level=50 # 10-50 --> Guest-Owner
curl --request POST --header "PRIVATE-TOKEN: ${token}" --data "user_id=${user_id}&access_level=${access_level}" "${url}/api/v4/groups/${group_id}/members"
# get user id
curl --header "PRIVATE-TOKEN: ${token}" "${url}/api/v4/users?username=ting.qin"
# block user
# POST /users/:id/block
curl --request POST --header "PRIVATE-TOKEN: ${token}" "${url}/api/v4//users/163/block