this post was submitted on 25 Oct 2024
13 points (100.0% liked)

Programming.dev Meta

2488 readers
1 users here now

Welcome to the Programming.Dev meta community!

This is a community for discussing things about programming.dev itself. Things like announcements, site help posts, site questions, etc. are all welcome here.

Links

Credits

founded 2 years ago
MODERATORS
 

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?

top 2 comments
sorted by: hot top controversial new old
[โ€“] [email protected] 5 points 1 month ago* (last edited 1 month ago) (1 children)

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

[โ€“] kiko 2 points 1 month ago

Will try that as soon as I can. Thanks...