# Waar wordt de nieuwe \`external\_id\` functie voor topics voor gebruikt?

**URL:** https://meta.discourse.org/t/what-is-the-new-external-id-feature-for-topics-used-for/218203
**Category:** Development
**Tags:** rest-api
**Created:** [15 februari 2022 om 05:05 UTC](https://meta.discourse.org/t/what-is-the-new-external-id-feature-for-topics-used-for/218203 "2022-02-15T05:05:25Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)
#### Post date: [15 februari 2022 om 05:05 UTC](https://meta.discourse.org/t/what-is-the-new-external-id-feature-for-topics-used-for/218203/1 "2022-02-15T05:05:25Z")

</div>

From [https://meta.discourse.org/t/2-9-0-beta2-security-fix-and-more/218086:](https://meta.discourse.org/t/2-9-0-beta2-security-fix-and-more/218086:)

> Add support for `external_id` to be used when creating and fetching topics. This is an API-only change

I have several (experimental at this point) api-based bots which link topics to external resources (like related bug or issue trackers relating to a conversion). [https://docs.discourse.org](https://docs.discourse.org) tells me what this is but not a lot of details of how this is meant to be used. Is there a longer explanation? It seems like this could be really useful!

---

<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: [15 februari 2022 om 21:31 UTC](https://meta.discourse.org/t/what-is-the-new-external-id-feature-for-topics-used-for/218203/3 "2022-02-15T21:31:01Z")

</div>

What drove this feature is that a lot of sites need to interact with discourse via some other external application but they often don’t have a good way of keeping track of all the internal discourse id’s for things to keep things in sync. Now that you can create a topic with an `external_id` it can become a lot easier to match up a specific discourse topic with a resource in your own application.

Just to clarify this new `external_id` feature is only for topics, not posts. So a topic can store an `external_id`, but a post cannot.

---

<div class="post-metadata">

### Author: ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)
#### Post date: [15 februari 2022 om 22:33 UTC](https://meta.discourse.org/t/what-is-the-new-external-id-feature-for-topics-used-for/218203/4 "2022-02-15T22:33:32Z")

</div>

Thanks @blake. So, “external\_id” can be arbitrary from my side? For [https://ask.fedoraproject.org/c/common-issues/141/none](https://ask.fedoraproject.org/c/common-issues/141/none), I’ve been doing something fairly horrible — getting the top post and then scanning the `link_counts` list for URLs which match the pattern of the external resource.

---

<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: [15 februari 2022 om 22:36 UTC](https://meta.discourse.org/t/what-is-the-new-external-id-feature-for-topics-used-for/218203/5 "2022-02-15T22:36:46Z")

</div>

> [@mattdm](#):
>
> So, “external\_id” can be arbitrary from my side?

Yes, as long as it falls under the format of a 50 character string including `-` and `_`.

---

<div class="post-metadata">

### Author: ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)
#### Post date: [16 februari 2022 om 13:54 UTC](https://meta.discourse.org/t/what-is-the-new-external-id-feature-for-topics-used-for/218203/6 "2022-02-16T13:54:13Z")

</div>

Ah, good to know. So, bug numbers, not full URLs. 🙂

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [3 oktober 2023 om 06:04 UTC](https://meta.discourse.org/t/what-is-the-new-external-id-feature-for-topics-used-for/218203/7 "2023-10-03T06:04:17Z")

</div>

A post was split to a new topic: [API topic’s external\_ID can’t be reused after deleting a topic and creating a new one](https://meta.discourse.org/t/api-topics-external-id-cant-be-reused-after-deleting-a-topic-and-creating-a-new-one/280835)

---

<div class="post-metadata">

### Author: ![Aaron\_B](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/aaron_b/32/327391_2.png) [@Aaron\_B](https://meta.discourse.org/u/Aaron_B)
#### Post date: [3 oktober 2023 om 05:31 UTC](https://meta.discourse.org/t/what-is-the-new-external-id-feature-for-topics-used-for/218203/8 "2023-10-03T05:31:30Z")

</div>

Can someone PLEASE expose external\_id to the embed.js interface? I really need to show posts on an external page connected to an external\_id where I don’t know the topic\_id.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [3 oktober 2023 om 06:02 UTC](https://meta.discourse.org/t/what-is-the-new-external-id-feature-for-topics-used-for/218203/9 "2023-10-03T06:02:35Z")

</div>

Hello Aaron 🙂  
No need to posts the same question over multiple places. Let’s continue in your original topic 👍

> [@Expose external\_id in embed.js](https://meta.discourse.org/t/expose-external-id-in-embed-js/280834):
>
> I am needing to load posts on an external site where I don’t know the post\_id but I DO know the external\_id that I configured when I created the topic. Can someone please expose the external\_id variable in the embed.js logic or teach me what I’m missing? Example support needed: window.DiscourseEmbed = { discourseUrl: ‘[https://forums.blah.org/](https://forums.blah.org/)’, external\_id: ‘2023-4’ };

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [3 oktober 2023 om 06:02 UTC](https://meta.discourse.org/t/what-is-the-new-external-id-feature-for-topics-used-for/218203/10 "2023-10-03T06:02:38Z")

</div>


