Let me preface by saying I am new to Discourse. I have constructed a query in Data Explorer that I would like to be used to populate a particular page on our website (It would basically show the topics under a particular category). From what I can see, I would require an All Users API key to fetch the data, but how can I avoid exposing this API key?
Is the solution to simply fetch the data server-side and then return it, or is there something I’m missing here? Is there some way to restrict the scope of an API key for this specific purpose?
Yes, making the request from your server is the correct approach.
You don’t need the data explorer for that, you can request the json for the category topic list and consume it using Javascript.
Thanks for replying . The reason I was leaning towards Data Explorer was because I wanted to show some text from the first post of the topic, however I realize now this may be possible by using the topic excerpt. I tried running the Category “List Topics” query specified in the API docs but do not seem to get back an ‘excerpt’ field for the topics. But running the Data Explorer query I can see that adding ‘t.excerpt’ returns the excerpt data.
I guess my question now would be how can I get topic excerpts through the API?
There is a hidden site setting for that:
SiteSetting.always_include_topic_excerpts = true
I am on a hosted plan though. Is it still possible to access these hidden settings?