About the REST api


(Timo) #1

Hi,

Not sure if support is the right category, but close enough I hope. Deployed discourse on a VPS and I like what I see so far. Due to the open REST API approach of the backend I was toying with the idea of using it for account management & forum solution for my upcoming weekend project app.

Due to that a few questions:

  1. Tried to look for some docs on the REST api, but couldn’t find much. Are there any?
  2. I’ve seen posts about the API going through some major rebuilding in near future. Will this affect the API itself or just the inner workings of it?

Timo


Mailing list (and NNTP) bridge
(Dan Neumann) #2

I would think the best resource is to look at Ruby on Rails’ routing guide.

That way you can decode the interface expressed in the routing file config/routes.rb.

And you can see all available routes (i.e. what the routes.rb file expands to) by running $ rake routes from Discourse folder.


(Timo) #3

Thanks… I guess the datasets to be posted need to be then reverse engineered from the files routes point to? So basically no documentation exists yet…


(marten) #4

Meh. Feels like this is a bit disingenuous to put on the front page of discourse.org then:

Comprehensive API

Discourse has an excellent API. How do we know? Because our JavaScript application is built on top of it. Just about anything you can do in a web browser is accessible via REST.

A REST API without documentation is hard to call “an excellent API”. Sure, the routes file shows what routes exist, but what do you post to it, and what can you expect to get back?


(Jeff Atwood) #5

That’s why you can download the source, for documentation and examples!


(Timo) #6

Checked out github and couldn’t find much info about he api from discourse/docs at master · discourse/discourse · GitHub. Where should I look for the api goodness?


(Aryan R) #7

Comprehensive API with no documentation is more or less useless for the community.


(Jeff Atwood) #8

You can always demand a refund. :wink:

But seriously, it’s beta software. We may radically chage the interfaces tomorrow. Why document it now, so early in the lifecycle of Discourse, when that would be incredibly risky and a waste of time?


(Aryan R) #9

That is understandable. But when on the homepage it says

Discourse has an excellent API. How do we know? Because our JavaScript application is built on top of it.

It is slightly misleading. Of course, you should be spending your time coding and not toying around linguistic properties of the homepage.

My prediction is that once Discourse gets more and more stable a lot of people are going to come to you and say “Hey we already have a popular forum with your beta version, help us update”. :smiley:


(YG WareNinja) #10

while in production environment, you can extract routes by running this command

RAILS_ENV=production bundle exec rake routes

and here comes Discourse routes extracted from v0.9.8.5

discourse_myroutes.txt (54.2 KB)


Reference generic Preferences link
(YG WareNinja) #11

…and here comes Java implementation to consume Discourse API endpoints!
-> GitHub - zeusbaba/discourse-api-client: Discourse API client in Java


(Clifford Duke) #12

Found someone attempting to implement a wrapper for NodeJS