Discourse api tutorial


(da.fans.lu) #1

Hi Everyone,
I want to use the discourse_api here: GitHub - discourse/discourse_api: Ruby API for Discourse to build a website that fetches the topics and other contents from another already hosted discourse forum. But it seems that there’s not much documentation on how to get it done.
Does anyone has a detailed instruction or tutorial for accomplishing the goal?

Thanks


(Arpit Jalan) #2

There is a tutorial for this now:


(da.fans.lu) #3

@techAPJ, Does the api supports replying to a certain post?


(nichtich) #4

By trial and error I found that you can add a format=json to each URL, for instance

The resulting JSON format should be documented somewhere (?).


(Mittineague) #5

Thats a “discoverable” “power user” feature


(Sam Saffron) #6

Simpler… just adding .json to the end of any URL.


#7

Out of curiosity, is there a way to authenticate a simple request like “http://domain.com/thread.json” with an API key? If not logged in, I get

[error: ‘invalid access’]

I’m trying to access things like reply_count, reads and score from a simple PHP based site.

I’ve looked at Discourse API PHP but it doesn’t seem to have functionality for a lot of endpoints.

Edit For some reason, the json links are working fine unauthenticated now, so nevermind :slight_smile: