What is the new `external_id` feature for topics used for?

From 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 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!

3 Likes

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.

6 Likes

Thanks @blake. So, “external_id” can be arbitrary from my side? For Common Issues - Ask Fedora, 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.

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

2 Likes

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

1 Like

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

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.

Hello Aaron :slight_smile:
No need to posts the same question over multiple places. Let’s continue in your original topic :+1: