Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Curl 如何列出子组';使用GitLab API的项目?_Curl_Gitlab_Gitlab Api - Fatal编程技术网

Curl 如何列出子组';使用GitLab API的项目?

Curl 如何列出子组';使用GitLab API的项目?,curl,gitlab,gitlab-api,Curl,Gitlab,Gitlab Api,在GitLab中,您可以在组中创建子组,并在这些子组中创建项目。GitLab文档允许您列出组的子组和组的项目,但是我找不到任何关于列出子组项目的内容。是否有人知道用于此的curl命令,或者至少知道它还不受支持 我试过: curl-s-H'PRIVATE-TOKEN:xxxxx'https://gitlab.com/api/v4/groups/mygroup/subgroups/mysubgroup/projects curl-s-H'PRIVATE-TOKEN:xxxxx'https://git

在GitLab中,您可以在组中创建子组,并在这些子组中创建项目。GitLab文档允许您列出组的子组和组的项目,但是我找不到任何关于列出子组项目的内容。是否有人知道用于此的curl命令,或者至少知道它还不受支持

我试过:
curl-s-H'PRIVATE-TOKEN:xxxxx'https://gitlab.com/api/v4/groups/mygroup/subgroups/mysubgroup/projects

curl-s-H'PRIVATE-TOKEN:xxxxx'https://gitlab.com/api/v4/subgroups/mysubgroup/projects


和其他类似的变体,但迄今为止运气不佳。

您应该能够通过所述组ID列出任何组(子组或非子组)的项目:

见“


因此,首先要获取他们的ID,然后查询他们的项目

使用
%2f
指定子组的完整路径:

curl -s https://gitlab.com/api/v4/groups/gitlab-org%2fgitter/projects

查看此图。

要获取组和子组的所有项目,请按如下方式调用api

curl --silent --header "Private-Token: YOUR_GITLAB_TOKEN" https://gitlab.example.com/api/v4/groups/<group_name>/projects?include_subgroups=true
GET /groups/:id/subgroups
curl--silent--header“私有令牌:您的\u GITLAB\u令牌”https://gitlab.example.com/api/v4/groups//projects?include_subgroups=true
或者使用组id

<your_gitlab-url>/api/v4/groups/<group_ID>/projects?include_subgroups=true
/api/v4/groups//projects?include_subgroups=true

要获取组的所有soubgrup,请像这样调用v4 gitlab API

curl --silent --header "Private-Token: YOUR_GITLAB_TOKEN" https://gitlab.example.com/api/v4/groups/<group_name>/projects?include_subgroups=true
GET /groups/:id/subgroups

谢谢你的回复。这适用于数字id,但不是组的实际名称,但我将使用它作为最终手段。