How to list posts, recent first, via API
Here's sample code that shows how you can call Talkyard's API to list posts and comments, most recent first. It's from automated e2e tests:
The request
Authentication, see: Talkyard API authentication
How to call the List API, see listPostsImpl()
:
https://github.com/debiki/talkyard/blob/f2c0a8e46b1065717a9a6645c72f905007816230/tests/e2e/specs/api-list-query-for-posts.test.ts#L112
which makes use of listQuery()
:
https://github.com/debiki/talkyard/blob/f2c0a8e46b1065717a9a6645c72f905007816230/tests/api/server.ts#L541
Payload JSON, see interface ListQuery
:
https://github.com/debiki/talkyard/blob/f2c0a8e46b1065717a9a6645c72f905007816230/tests/e2e-wdio7/pub-api.ts#L825
The response
Response of type ListQueryResults
:
https://github.com/debiki/talkyard/blob/f2c0a8e46b1065717a9a6645c72f905007816230/tests/e2e-wdio7/pub-api.ts#L879
which lists posts, type PostListed
:
https://github.com/debiki/talkyard/blob/f2c0a8e46b1065717a9a6645c72f905007816230/tests/e2e-wdio7/pub-api.ts#L359
(This should be rewritten to proper API docs, some time later. I hope it's better than nothing, for now.)
Previous discussion: Talkyard List API