Skip to content

API Endpoints Documentation

riking edited this page Dec 28, 2014 · 5 revisions

This document will always be a work-in-progress until there is a freeze of any sort on the routes.

See also:

Miscellany

/srv/status

Parameters: None
Response:

  • Code 200, text ok: Forum is running
  • Code 500, text shutting down: The /var/www/discourse/tmp/restart file was touched, and the web process that served your request is about to restart itself.
  • Any other response: Forum is not running

/error

Parameters: None
Response: Code 500, no content.

/site.json

Parameters: None
Response: A JSON object containing a JSON object named 'site'.

  • site.default_archetype: regular. Not sure that this has any use.
  • site.notification_types: A map from notification type name to ID, as used in /notifications.json.
  • site.post_types: A map of post type name to ID, as used in post JSONs.
  • site.groups: An enumeration of all group names and IDs on the forum.
  • site.filters: All available list filter types. These are used in building some URLs. The current value is [latest, unread, new, starred, read, posted].
  • site.periods: All available 'top topics' periods. These are used in building top topic list URLs. The current value is [yearly, monthly, weekly, daily].
  • site.top_menu_items, site.anonymous_top_menu_items: "Available" top menu items. The value of the top_menu site setting is filtered based on one of these two depending on whether the user is logged in or not.
    • Any top_menu site setting item that is not contained in the appropriate list, after removing text after commas , and slashes /, is ignored. Valid top_menu site setting example: top|category/Category Name|latest,-Category Name
  • site.uncategorized_category_id: The category ID of the uncategorized category.
  • site.is_readonly: If this is true, the site is in read-only mode and all requests other than GETs are blocked. You should update this variable in your model by subscribing to the /site/read-only channel on the message bus.
  • site.categories: All categories visible to you on the site.
    • site.categories[n].slug: The URL part for making requests about this category.
    • site.categories[n].description: HTML description of the category.
    • site.categories[n].description_text: Plain text description of the category.
    • site.categories[n].topic_url: The URL of the category definition topic, from which the description is generated.
    • site.categories[n].read_restricted: If true, anonymous users cannot read posts in this category.
    • site.categories[n].permission: BROKEN

/about.json

Parameters: None
Response: JSON data for the /about page.