this post was submitted on 19 Jun 2023
5 points (100.0% liked)

Lemmy App Development

792 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:

Off-Topic:

founded 2 years ago
MODERATORS
 

This happens for me on a small number of posts, and is generally repeatable, even when the website shows comments.

For instance, running on lemmy.world, GetPost(id: 290602) tells me the post exists and has 7 comments, as does https://lemmy.world/post/290602

But GetComments(postId: 290602) returns an empty list.

If I run against the original post on 'programming.dev', GetComments(postId: 99912) does show me the comments, but I don't think I'm supposed to be second guessing the federating logic :-)

Has anyone seen anything similar or can confirm they see this same behaviour for this post?

top 6 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 2 years ago* (last edited 2 years ago) (1 children)

Quick update for anyone reading this:

I've just worked out how to use curl with the Lemmy API, and sadly curl -H 'Accept: application/activity+json' "https://lemmy.world/api/v3/comment/list?limit=10&postId=290602" does show the comments, so I had to accept that there's something wrong in my request.

Having fiddled about a bit it appears that setting the type parameter controls whether non-local comments get included, so adding type: CommentListingType.all solved this problem.

[–] [email protected] 1 points 2 years ago* (last edited 2 years ago)

Hi! The first curl example doesn't seem to work - it fetches comments but they are not relevant to https://lemmy.world/post/290602 :

> curl -H 'Accept: application/activity+json' "https://lemmy.world/api/v3/comment/list?limit=10&postId=290602" | jq -c '.comments[] | [.post.id, .comment.id, community.name]'
[484044,486431,"nostupidquestions"]
[455772,486976,"giftofgaming"]
...
[485477,486428,"outoftheloop"]
[484044,485717,"nostupidquestions"]

It seems that we need to set type_ parameter like this:

> curl -H 'Accept: application/activity+json' "https://lemmy.world/api/v3/comment/list?limit=10&post_id=290602&type_=All" | jq -c '.comments[] | [.post.id, .comment.id, community.
name]'
[290602,484328,"programmer_humor"]
[290602,374758,"programmer_humor"]
...
[290602,355277,"programmer_humor"]
[290602,345799,"programmer_humor"]
[–] [email protected] 2 points 2 years ago

Yes! I didn't see your post, I'm having the same issue, specifically with the instances lemmy.world and feddit.de. Good to know it's not my fault I guess?

[–] [email protected] 2 points 2 years ago (1 children)

I was running into this. I’ve noticed that some instances seem to have limits to how many comments you can fetch at a time, especially when there is no “limit” or “page” set. Setting “limit” or “page” or a parent id seems to avoid it. The limits for each server might be under getSite(), but if those limits are related to this issue specifically, haven’t tested it

[–] [email protected] 1 points 2 years ago

Thanks, that’s an interesting gotcha to watch out for.

[–] [email protected] 1 points 2 years ago

I was running into this. I’ve noticed that some instances seem to have limits to how many comments you can fetch at a time, especially when there is no “limit” or “page” set. Setting “limit” or “page” or a parent id seems to avoid it. The limits for each server might be under getSite(), but if those limits are related to this issue specifically, haven’t tested it

load more comments
view more: next ›