# Constructing web accessible links to posts and topics programmatically

**URL:** https://meta.discourse.org/t/constructing-web-accessible-links-to-posts-and-topics-programmatically/238888
**Category:** Development
**Created:** [September 13, 2022, 3:58pm UTC](https://meta.discourse.org/t/constructing-web-accessible-links-to-posts-and-topics-programmatically/238888 "2022-09-13T15:58:20Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![balazswmann](https://avatars.discourse-cdn.com/v4/letter/b/58956e/32.png) [@balazswmann](https://meta.discourse.org/u/balazswmann)
#### Post date: [September 13, 2022, 3:58pm UTC](https://meta.discourse.org/t/constructing-web-accessible-links-to-posts-and-topics-programmatically/238888/1 "2022-09-13T15:58:21Z")

</div>

Hi everyone,

In case of a 3rd party integration when I send a search request [to the API endpoint](https://docs.discourse.org/#tag/Search/operation/search), I get back post and topic properties such as ID, title, author, etc. My question is: what’s the “correct” way to construct a web accessible URL for a post or a topic?

Taking a look to the share links in the forum, I see that they usually follow the `https://meta.discourse.org/t/[TOPIC TITLE]/[TOPIC ID]/[COMMENT ID]` pattern but I’m not sure this is what I’d need to put together.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [September 13, 2022, 4:05pm UTC](https://meta.discourse.org/t/constructing-web-accessible-links-to-posts-and-topics-programmatically/238888/2 "2022-09-13T16:05:48Z")

</div>

> [@balazswmann](#):
>
> what’s the “correct” way to construct a web accessible URL for a post or a topic?

`domain/t/topic_id/post_id` works and will issue a redirect to the canonical URL.

---

<div class="post-metadata">

### Author: ![balazswmann](https://avatars.discourse-cdn.com/v4/letter/b/58956e/32.png) [@balazswmann](https://meta.discourse.org/u/balazswmann)
#### Post date: [September 13, 2022, 5:27pm UTC](https://meta.discourse.org/t/constructing-web-accessible-links-to-posts-and-topics-programmatically/238888/3 "2022-09-13T17:27:20Z")

</div>

@Falco I see, thank you for the info! That will be perfect I think.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [September 14, 2022, 1:32am UTC](https://meta.discourse.org/t/constructing-web-accessible-links-to-posts-and-topics-programmatically/238888/4 "2022-09-14T01:32:04Z")

</div>

> [@Falco](#):
>
> domain/t/topic\_id/post\_id

I often see `domain/t/-/topic_id/post_id`. Is one preferred?
