官方api 文档: https://s0docs0gitlab0com.icopy.site/ee/api/api_resources.html

    1. token=D3ro1i76p9FLDE3sQxdg
    2. url=http://10.1.6.161/
    3. # 获取组的详细信息
    4. group_name="myg2"
    5. curl --header "PRIVATE-TOKEN: ${token}" ${url}/api/v4/groups/${group_name}
    6. # 添加一个组
    7. add_group_name="ylbAdd"
    8. curl --request POST --header "PRIVATE-TOKEN: ${token}" --data "name=${add_group_name}&path=${add_group_name}" ${url}/api/v4/groups;
    9. # 添加一个子组
    10. sub_group_name="yy1"
    11. parent_id=254
    12. curl --request POST --header "PRIVATE-TOKEN: ${token}" --data "name=${sub_group_name}&path=${sub_group_name}&parent_id=${parent_id}" ${url}/api/v4/groups;
    13. # members: https://docs.gitlab.com/ee/api/members.html
    14. # 或取组中的成员
    15. group_id=254
    16. curl --header "PRIVATE-TOKEN: ${token}" "${url}/api/v4/groups/${group_id}/members"
    17. # 将用户添加到组中
    18. user_id=157
    19. group_id=254
    20. access_level=50 # 10-50 --> Guest-Owner
    21. curl --request POST --header "PRIVATE-TOKEN: ${token}" --data "user_id=${user_id}&access_level=${access_level}" "${url}/api/v4/groups/${group_id}/members"
    22. # get user id
    23. curl --header "PRIVATE-TOKEN: ${token}" "${url}/api/v4/users?username=ting.qin"
    24. # block user
    25. # POST /users/:id/block
    26. curl --request POST --header "PRIVATE-TOKEN: ${token}" "${url}/api/v4//users/163/block