Topic API gets the wrong posts- consistently off by 5

This endpoint promises to return information including the specified post, for example:

○ → curl -s 'https://meta.discourse.org/t/fkb-pro-social-theme/234323.json?post_number=40' | jq .post_stream.posts[].post_number
33
34
35
36
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

As a single-page application, Discourse uses its API efficiently to minimise work. It’s not reasonable to make one API call per post; that would massively balloon the amount of back and forth between client and server.

It’s trivial to select the post you expect from the result. Same as above, getting only post 40’s cooked content:

○ → curl -s 'https://meta.discourse.org/t/fkb-pro-social-theme/234323.json?post_number=40' | jq -r '.post_stream.posts[] | select(.post_number == 40) | .cooked'
<p>Hi Tiago,</p>
<p>Can you please clarify it a little bit? Some screenshots, your actual code and where is your advert appear would be very helpful. Thank you <img src="https://emoji.discourse-cdn.com/twitter/slightly_smiling_face.png?v=12" title=":slightly_smiling_face:" class="emoji" alt=":slightly_smiling_face:" loading="lazy" width="20" height="20"></p>

Or, if you absolutely want to return information about only the single post you are querying, you are free to make a Data Explorer query that does only that.

1 Like