Please view the Discourse API Documentation site for detailed info:
The Content-Type must be set to “application/x-www-form-urlencoded” or “multipart/form-data” otherwise you may receive a bad request response.
Here is an example POST request via cURL:
curl -X POST "http://127.0.0.1:3000/categories" \ -H "Content-Type: multipart/form-data;" \ -F "api_key=714552c6148e1617aeab526d0606184b94a80ec048fc09894ff1a72b740c5f19" \ -F "api_username=discourse1" \ -F "name=89853c20-4409-e91a-a8ea-f6cdff96aaaa" \ -F "color=49d9e9" \ -F "text_color=f0fcfd"
Here is an example of what the ReDoc site looks like:
In addition to the docs site, you can also import the postman JSON files into
postman to test making real API calls and see the JSON output.
Start by importing the environment JSON file. After you import it be sure to
api_key values to match your
Now you can import the collection JSON file and start making API requests.
Here is a demo:
Consuming the API
You can consume the API using cURL commands, but we recommend using the discourse_api gem so that you can use Ruby.