[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Question about Salsa API: How to get all projects (including in subgroups) of a team



Am Sonntag, den 11.02.2018, 20:07 +0100 schrieb Daniel Leidert:
> Am Samstag, den 10.02.2018, 18:56 +0100 schrieb Andreas Tille:
> > Hi,
> > 
> > I think I have seen the answer to my question here before but I
> > failed
> > finding it:  I want to read the certain files of the debian/ dir of
> > all
> > projects of a team (including subgroups).  So how can I get the names
> > (and subdirs!) of all packaging projects of Debian Science?
> 
> https://salsa.debian.org/help/api/groups.md
> 
> curl --request GET \
>      --header "PRIVATE-TOKEN: <token>" \
>      --data "simple=true" -s \
>      https://salsa.debian.org/api/v4/groups/science-team/projects | \
>      jq -r '.[].name'

I just recently found, that the output is limited and can only be
increased to 100 at max. It seems however, that it contains all
projects, even those from sub-groups:

curl --request GET --data "simple=true&per_page=100&order_by=name&sort=asc" -s \
     https://salsa.debian.org/api/v4/groups/science-team/projects | jq -r '.[].name'

To get all packages, you probably have to examine the response, which
contains 'Link' elements as described here:
https://docs.gitlab.com/ee/api/README.html#pagination-link-header

You get the idea, when you run curl with the -i|--include switch to get
the response headers. In your case even using the maximum number of 100
items per page, the total amount of pages is 14. In your case there are
1351 packages in the science-team group (from the response):

> X-Total: 1351
> X-Total-Pages: 14

I'm also stuck atm how to solve this issue via Perl.

Regards, Daniel

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: