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

Programming.dev Meta

2468 readers
4 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 1 year ago
MODERATORS
 

Posting here also, because nmtake@lemm.ee 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
[โ€“] ptz@dubvee.org 5 points 3 weeks ago* (last edited 3 weeks 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@programming.dev 2 points 3 weeks ago

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