A user, m45t3r, is developing a blog-like interface using the Discourse JSON API. They want to sort topics by created_at, but the /latest.json endpoint sorts by last_posted_at. m45t3r notes that the Discourse API documentation is outdated.
@blake responds that they are working on updating the API documentation. m45t3r considers modifying the CSS to hide features or creating a server-side application to sort posts, but prefers a solution using the existing API.
@mcwumbly suggests using the order=created parameter with the /latest.json endpoint, which seems to solve the issue for m45t3r.
I am developing a blog-like interface for a private Discourse deployment based on the JSON API from Discourse. The idea is simple: the owner of the Discourse is the only one that can post questions in a certain category. This category will be used as a base for the posts in the blog.
The problem is, I can’t figure out how to get the topics sorted by created_at. /latest.json is almost there, however it sorts by last_posted_at, so if I made a blog based on latest.json the top posts would be the post last commented by an user, not the more traditional most recent created post.
Btw, the Discourse API documentation seems to be really outdated, since I discovered for example that passing /latest.json?page=1 allow me to see the next 30 topics (each call from the API gives at most 30 topics and this does not seem to be documented anywhere).
Nice! I like this idea. I played around with a blog layout in the past. Mostly I just modified the css to hide certain features I didn’t need or wanted other users to see.
I’ll look into this, but not sure if an existing route exists off the top of my head.
I’m currently working on updating the api docs. It will be done soon(ish) ;)
This would be an option too, however in this case I would still have the problem of the user bumping posts to the top when answering right? Or is there a way in Discourse itself to force posts sorted by created_at?
Well, the other option would be to created a small server side application and sort the posts there, however this would be a uglier solution. The other option we’re thinking is to use a blog application and use Discourse only for comments, however the client would like to use Discourse itself to post new topics because he likes the interface.