this post was submitted on 24 Jun 2023
1 points (100.0% liked)
Lemmy App Development
693 readers
1 users here now
A place for Lemmy builders to chat about building apps, clients, tools and bots for the Lemmy platform.
On-Topic:
- programming questions related to the Lemmy platform
- sharing your ideas, WIP, or released Lemmy-related work
Off-Topic:
- general programming questions unrelated to Lemmy
- feature requests for developers
- sharing or promoting work not related to Lemmy
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I'd call
GET /api/v3/comment/list?post_id=<post_id>&type_=All
to get comments, then sort the comments withpath
attribute.thanks for the clear info. i think i'd missed the All type_. now off to find the path attribute.
so "path" is a decimal separated list of comment ids? docs say nothing, but it looks like that.
Yes. See here.
chiming in here because I’m trying to figure this out too. If there’s say, thousands of comments, and I don’t want to get all of them at once, how would I sort them based off the path? I don’t want to miss any replies to comments that are loaded, and it doesn’t appear that comments returned are sorted or grouped together in any way by default
Pretty late to the party here, but I have an answer for you. There another parameter called "depth", you have to set that to "1" on the initial call. Then you only get "root" comments. Then, for each root comment, you call the API again with the parent id of said comment with the "depth" parameter set to depth+1 until there are no more comments.
So basically, you have to use recursion. If you want I can give you a code example from my App.