Read Only API user


#1

Hi there,

I’m trying to create an API integration from a website that will show some overall Discourse stats (from the /about page), and some stats for some specific categories.

I’m just wondering how best to do this with users. Is there any way I can create a site-wide, “read-only” user for pulling this kind of information out of Discourse? What would you advise?

Thanks

Ross


#2

Can’t you just use the already read-only JSON interface Discourse provides? Just add .json after any Discourse url to see what I mean.

/categories.json seems to provide what you’re looking for.


#3

But this API access (even for general routes like the /about.json) needs a login. And I want a login that will only be able to READ data. I only seem to be able to create users that can read and write. Is that correct?


#4

Does it? I just opened it up in an incognito window without having to login.


#5

Well it depends on how your forums are configured. In mine, yes, a login is needed for everything. But you could have a completely open site, or more finely-controlled forums with specific private categories. I want a user than can be read-only for everything.

Well…for all the main categories in my forums.

Actually - looking at category security options, I may have found the answer: put the API user in a group and give that group “See” access only. That could work. I’ll try that out.

Thanks