blog

archives

Discourse API Documentation Released!

Blake Erickson March 6, 2017

Today we would like to announce our much anticipated Official API Docs!

You can find them at: http://docs.discourse.org

Today, more than ever, an application needs to be able to integrate with other applications and the Discourse API allows you to easily integrate your Discourse forum with any other application. We do have a Ruby based API client, but your company or server might not support Ruby, so our documentation can easily be used to write an integration in any programming language through simple HTTP REST calls.

To aid in integrating with the Discourse API there are Postman files that you can import into your Postman app so that you can easily make API calls. Postman is a great tool that allows you to make API requests and see the HTTP status codes and responses. It can be a lot friendlier to use instead of a command line tool like cURL. Here is a demo:

What can you do with the API?

Anything you want! Because Discourse is a JavaScript application (with a Rails backend), we consume our own API, so anything the web application does your API integration can do as well.

You can use the API to manage all aspects of users like creating new user accounts, suspending a user, logging off a user, and assign roles to a user.

You can also create and respond to topics, gather stats about users, send private messages, upload files, and pretty much anything else you can think of.

Discourse also has support for webhooks! This means that Discourse will send a POST request to an endpoint you specify every time an event triggers such as a new topic, new post, or a new user is created. This means that if you wanted to be notified every time someone mentions a specific keyword you wouldn’t have to poll Discourse every X minutes, but instead could just listen for the webhook event. Your app could then parse the topic and then use the API to send you a personal message in Discourse notifying you that keyword was used.

Contributors Welcome

The Discourse API Docs are of course open source and so contributions are more than welcome. If you find a bug, an un-documented endpoint, or anything else please feel free open a pull request following the contributing instructions.

Notable Replies

  1. Already nostalgic for the old "documentation"!

    :sweat_smile::sweat_smile::pizza:

  2. That is still useful if you want to know exactly what API calls are needed for a particular UI action!

Continue the discussion meta.discourse.org

Participants