Help with Lemmy API - eviltoast

I would like to be able to use the command line (curl) to get a list of communities I am currently subscribed to.

I know that there is a full-blown API, but it only briefly covers what it is possible with simple a curl request, and most of it seems to refer to an API that runs in javascript (which seems excessively complex for what I want to do?)

A simple curl request like this seems to work,

curl "https://mander.xyz/api/v3/community/list" | jq

But I wouldn’t know how to make it list only communities that I subscribe to? Does anyone know more?

  • notsofunnycomment@mander.xyzOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    This works! Thanks.

    If you’re up for it, one last question: just running curl "https://mander.xyz/api/v3/community/list?auth=longstring&type_=Subscribed gives me only a few subscribed communities.

    I can increase the number of subscribed communities that I get back, by adding &limit=.

    curl "https://mander.xyz/api/v3/community/list?auth=longstring&type_=Subscribed&limit=50"

    However, putting the limit too low I don’t get all my subscribed communities, while putting the limit too high results in an error.

    Is there a way to set limit to “max” or the limit to “nil” or something like that?

      • notsofunnycomment@mander.xyzOP
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        1 year ago

        Ok, I’ll keep the monologue going: turns out I can loop through pages with that limit:

        curl "https://mander.xyz/api/v3/community/list?auth=longstring&type_=Subscribed&limit=50&page=1

        And then

        curl "https://mander.xyz/api/v3/community/list?auth=longstring&type_=Subscribed&limit=50&page=2

        Etc.