# Get only top level posts in topic via discourse API

**URL:** https://meta.discourse.org/t/get-only-top-level-posts-in-topic-via-discourse-api/86319
**Category:** Development
**Tags:** rest-api
**Created:** [4월 27, 2018, 4:46오후 UTC](https://meta.discourse.org/t/get-only-top-level-posts-in-topic-via-discourse-api/86319 "2018-04-27T16:46:18Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [4월 27, 2018, 6:06오후 UTC](https://meta.discourse.org/t/get-only-top-level-posts-in-topic-via-discourse-api/86319/2 "2018-04-27T18:06:46Z")

</div>

> [@coopaloop](#):
>
> the only way I can tell that 5 is a reply to 1 is by examining the post itself, finding “reply\_to\_post\_number”=\>1 and filtering it out. Am I missing something?

That is correct. There is not a filter that can be added to the topic endpoint to get what you are after. However we do have the

> [@Discourse Data Explorer](https://meta.discourse.org/t/data-explorer-plugin/32566):
>
> discourse2Summary Discourse [Data Explorer](https://meta.discourse.org/t/32566?silent=true) allows you to make SQL queries against your live database, allowing for up-to-the-minute stats reporting.open_bookInstall Guide This plugin is bundled with Discourse core. There is no need to install the plugin separately.information_source If you’re looking for examples or support for any custom queries, you can find lots of topics in our #data-reporting category under the #sql-query tag. If there’s not one to suit your par…

which you could use to write a sql query to get what you are after. You can then save that query and hit the api endpoint for the saved query and pass it a topic\_id as a param.

---

_[View the full topic](https://meta.discourse.org/t/get-only-top-level-posts-in-topic-via-discourse-api/86319)._
