# Retrieving top level replies on a topic

**URL:** https://meta.discourse.org/t/retrieving-top-level-replies-on-a-topic/152061
**Category:** Development
**Tags:** rest-api
**Created:** [20 mei 2020 om 11:19 UTC](https://meta.discourse.org/t/retrieving-top-level-replies-on-a-topic/152061 "2020-05-20T11:19:18Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ManishTripathy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/manishtripathy/32/142402_2.png) [@ManishTripathy](https://meta.discourse.org/u/ManishTripathy)
#### Post date: [20 mei 2020 om 11:19 UTC](https://meta.discourse.org/t/retrieving-top-level-replies-on-a-topic/152061/1 "2020-05-20T11:19:18Z")

</div>

I have a requirement where we need to fetch all the first level replies made on a topic. Now when we create a new topic, it also creates a post. In order to create a first level reply on the topic, I make the below API call

> POST [http://discourse-url/posts/](http://discourse-url/posts/)  
> {  
> “raw”: “This is a first level reply on a topic”,  
> “topic\_id”: 1234,  
> **“reply\_to\_post\_number”: null**  
> }

Now to retrieve the first level replies, I make the below call with `post_id` as the ID of the first post created for the topic. This post has the `post_number` as 1

> GET [http://discourse-url/posts/{post\_id}/replies.json](http://discourse-url/posts/%7Bpost_id%7D/replies.json)

But this returns me an empty array. This is understandable as Discourse treats the top level replies on a topic as posts and not replies. In Discourse terminology, “replies” are made on posts and “posts” are made on topics.

I have found a workaround for the same. Rather than sending `reply_to_post_number` as null, if I send it as 1, the API call for replies also works fine. Below is the sample request:

> POST [http://discourse-url/posts/](http://discourse-url/posts/)  
> {  
> “raw”: “This is a first level reply on a topic”,  
> “topic\_id”: 1234,  
> **“reply\_to\_post\_number”: 1**  
> }

Now I could fetch the first level replies for this topic by making the below API call

> GET [http://discourse-url/posts/{post\_id}/replies.json](http://discourse-url/posts/%7Bpost_id%7D/replies.json)

Going by the answer here [Posts vs Replies vs Topic](https://meta.discourse.org/t/difference-between-topics-posts-and-replies/104327), I feel I have made a fundamental change to the structure of the posts in Discourse now.  
My question is: Can this change break any other functionality in Discourse? Currently I don’t see any issues in the website with this change. But is there something that I might be missing and should be careful about?

---

<div class="post-metadata">

### Author: ![ManishTripathy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/manishtripathy/32/142402_2.png) [@ManishTripathy](https://meta.discourse.org/u/ManishTripathy)
#### Post date: [25 mei 2020 om 11:51 UTC](https://meta.discourse.org/t/retrieving-top-level-replies-on-a-topic/152061/2 "2020-05-25T11:51:36Z")

</div>

Could you please help me understanding the side effects of converting posts to replies by changing `reply_to_post_number` as 1 instead of null?
