Solved How to retrieve all posts by user via Read API?

  • My goal is to use the Read API to calculate the postcount of a user for a certain period of time.

    For this my approach would be to query all postings of a user and then filter out on the code side those postings that lie in a given period.
    According to the Read API documentation I have queried the user posts via:

    GET /api/user/{userslug}/posts

    However, it seems that this API call only returns a maximum of 20 posts.

    But how can I retrieve all posts of a user?

    I also tried this API call:

    GET /api/user/uid/{userslug}/export/posts

    but it doesn't seem to work at all (maybe it is outdated?). If I change the user slug accordingly, I get no result page, but 404.

  • NodeBB Admin

    You should be able to use pagination on the /api/user/{userslug}/posts route. IE /api/user/{userslug}/posts?page=2.

  • @baris said in How to retrieve all posts by usere via Read API?:


    that one works, thanks a bunch!

    I tried pagination before, but I was somehow expecting it to work like /{pagenumber}.

    Just for the record: Meanwhile I also understood, that what I was looking for is also achievable via /api/search and corresponding filters.

Suggested Topics

| | |

© 2014 – 2022 NodeBB, Inc. — Made in Canada.