How to find the post id inside a topic

We are planning to add permalinks to our old forum links inside discourse.
We know how to get the category Id and the Topic Id.
But how can we write a permalink for the post using the Post Id.
Where can we find the post id?

If you used an import script there is a post custom field for each post that contains the import id. You can use that and permalink normalization (in site settings) to create the permalinks. You can look in some of the existing importers for “Permalink” to see some examples.

But I’m fairly certain that the post id is in the json load for the topic.

Thanks Jay.

We are able to get the post id using the Data Explorer queries.

Whatever works, but see for example https://meta.discourse.org/t/how-to-find-the-post-id-inside-a-topic/189132/3.json.

But I’d also have a look at

./launcher enter app
rails c
pcfs=PostCustomField.where(name: 'import_id')

You can then do something like

pcfs.each do |pcf|
  Permalink.create(...)
1 Like