Is there is any open API for getting similar topic in discourse?

I need a api that give me similar topics.
My requirement - If i have a topic title then i will get the similar topics.

You will see that if you request the JSON for a topic, it has a section called suggested_topics.

https://meta.discourse.org/t/144806/2.json:

image

From title to topic ID can be done using search:

https://meta.discourse.org/search.json?q=title%3A%22Is%20there%20is%20any%20open%20API%20for%20getting%20similar%20topic%20in%20discourse%22&page=1

image

6 Likes

I think you should use: so that related articles are related to each other. From title to topic ID can be done using search:

Its working on meta.discourse but not on my forum. Our forum is forum.crio.do
If i will forum.crio.do/t/8497/2.json then no result was there

That seems like a private community so unauthenticated requests will not return any data. It works on Meta using https://meta.discourse.org/t/144806/2.json because the content is publicly viewable.

See Discourse API Documentation and Using the Discourse API Ruby Gem for more info on authenticating your requests with an api_key and api_username.

1 Like

That specific topic only has one post so there is no post 2.
It needs to be https://forum.crio.do/t/8497/1.json

You can always use t/<topic_id>/1.json

And indeed, you need to use an API key since you have a closed community.

2 Likes