Sometimes an API request returns {"comments":[]} and {"posts":[]} respectively, for a post and community, where posts and comments show up on the web frontend. Is that happening to any of you too? How do I handle it?

Edit: did some more testing, it’s most definitely a federation issue. If I query the instance that the post was made on for the comments, everything works fine. If I query my home instance, the result comes back empty.

Edit 2: As always, just after publicly showcasing my lack of programming abilities, I discover it’s been me the entire time. Make sure to await promises and to fetch posts from the correct instance, guys.

You are viewing a single thread.
View all comments View context
0 points
*

To be clear, I checked twice that my limit and page parameters are correct. I request page 0 with limit 10 and get nothing, while the post counts clearly say there are multiple comments and while the web interface shows them normally. Very weird

permalink
report
parent
reply
0 points
*

I request page 0 with limit 10 and get nothing

Lemmy API starts at page 1, page 0 is invalid?

curl "https://lemmy.ca/api/v3/post/list?limit=2&page=1"
curl “https://lemmy.ca/api/v3/comment/list?post_id=648889&type_=All&limit=2&page=1

page=0 returns {“error”:“couldnt_get_posts”} (or comments)

permalink
report
parent
reply
0 points

I meant page 1, sorry

permalink
report
parent
reply

Lemmy App Development

!lemmydev@lemm.ee

Create post

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

Community stats

  • 18

    Monthly active users

  • 57

    Posts

  • 21

    Comments

Community moderators