Discourse is backed by a complete JSON api. Anything you can do on the site you can also do using the JSON api.

Many of the endpoints are properly documented in the discourse_api gem, however some endpoints lack documentation.

To determine how to do something with the JSON API here are some steps you can follow.

Example: recategorize a topic.

  • Go to a topic and start editing a category:

  • Open Chrome dev tools, select XHR filter:

  • Perform the operation

  • Look at preview as well to figure out the results

  • You now have all the info you need.
  1. The endpoint is http://try.discourse.org/t/online-learning/108.json

  2. Payload is passed using a PUT

  3. The params sent are:
    title: Online learning
    category_id: 5

Equip with this information you can make your own calls using your favorite programming language, all you need to do is add api_username and api_key to parameters to the request.

They can be generated using the API admin tab.

Source: https://meta.discourse.org/t/how-to-reverse-engineer-the-discourse-api/20576