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

Re: salsa namespace_id for debiangames-team



On Tue, Jan 09, 2018 at 11:49:42PM +0800, Drew Parsons wrote:
> I could create a project for it on salsa, but from the salsa docs and
> the script at https://wiki.debian.org/Salsa/Doc#Import_git_repository
> it should be possible to port the alioth repo over to salsa using curl and the gitlab api.
> 
> The curl command uses namespace_id=2 for general debian packages, and
> the docs say to look up namespace ids for other groups with
>     curl     https://salsa.debian.org/api/v4/groups     | jq . | less
> 
> But there is no listing there for debiangames-team.

Hello Drew,

Looks like GitLab uses header [pagination](https://docs.gitlab.com/ee/api/README.html#pagination-link-header):

    $ curl -I https://salsa.debian.org/api/v4/groups
    ...
    Link:
    <https://salsa.debian.org/api/v4/groups?order_by=name&owned=false&page=2&per_page=20&sort=asc&statistics=false>; rel="next",
    <https://salsa.debian.org/api/v4/groups?order_by=name&owned=false&page=1&per_page=20&sort=asc&statistics=false>; rel="first",
    <https://salsa.debian.org/api/v4/groups?order_by=name&owned=false&page=7&per_page=20&sort=asc&statistics=false>; rel="last"
    ...
    X-Total-Pages: 7

So as a quick hack you can get the next page URL with:

    curl -I https://salsa.debian.org/api/v4/groups | sed -n -e '/Link/p' \
    | awk -F'<|>' '{print $2}' | xargs curl

debiangames-team is ID 2006
--
Phil Morrell (emorrp1)

Attachment: signature.asc
Description: PGP signature


Reply to: