Posting here also, because [email protected] commented that the API should work as expected on lemm.ee for instance and I don’t know where is the right place to post my question. Can someone help?

cross-posted from: https://programming.dev/post/20954226

I try to get comment data for my posts via API from my Lemmy instance, but whatever I try on using the GetComments endpoint it delivers an empty array.

For example … GET https://programming.dev/api/v3/comment/list?post_id=20878811 leads to:

{
  "comments": []
}

I want to ask here, before creating an issue. Has someone a hint?

  • Admiral Patrick@dubvee.org
    link
    fedilink
    English
    arrow-up
    5
    ·
    edit-2
    1 month ago

    Add the param type_=All

    Not sure why that’s needed since it’s listed as an optional parameter, but it is. You’ll also need to use max_depth or use limit and page to get them all.

    I usually use max_depth and load all of the top-level comments and 2 levels of replies to those (max_depth = 3) and if any of those have replies, I have a “Load more” button below the comment which will fetch again with that comment as the parent id.

    https://join-lemmy.org/api/interfaces/GetComments.html