Programmatic way to get all API endpoints for my instance?

I’m looking for a way to get a definitive list of the API endpoints available in my Discourse instance. It can sometimes be difficult to know what APIs are available to me when looking to build an integration into the platform.

4 Likes

I don’t think that’s technically possible. Discourse doesn’t have an API discovery route (for example, something similar to the WordPress /wp-json route). The closest thing I’m aware of is the documentation at https://docs.discourse.org/.

For integrations that aren’t covered by the docs, probably the fastest way to figure out if they’re doable is to ask on here about how to achieve some specific goal. The general rule with the API is that anything that can be done through the Discourse UI can also be done via the API.

8 Likes

Appreciate the response, Simon! I’m familiar with docs.discourse.org (which funny enough aren’t the official docs but the API specs).

I’m also familiar with using my browser console to capture requests as well as perusing through routes.rb files.

As you can imagine though—the two options above are quite tedious and not quite user friendly. For those of us looking to build deep integrations quickly–especially if we have other teams in our business or third party vendors who want to integrate…telling them to do the above things has had a terribly poor response.

While I’m aware of the flexibility in Discourse’s capabilities, developing on or integrating with the platform is an uphill battle to say the least. As a last-ditch effort, I was hoping there may have been a programmatic way to aggregate the public APIs.

6 Likes

The definitive source, other than the source is to Reverse engineer the Discourse API.

Everything that you can do on the front end you can do with the API. There are a very few things that you can do only with the API.

2 Likes

Can you clarify what you mean by this a bit more?

While Simon’s point about these not covering APIs that are implemented by extensions to Discourse (e.g. plugins), these docs are official in the sense that we do maintain them.

That’s not to say we don’t have a fair bit of room to improve when it comes the server side API documentation, and the API itself, but I did want to understand your feedback about the documentation that does exist there a bit better.