Add category moderators with the API?

AI-generated summary

The discussion revolves around using the Discourse API to manage category moderators. JQ331 asks if it’s possible to set category moderators via the API, noting the need to use POST or PUT requests with permission settings. Falco suggests using the How to reverse engineer the Discourse API guide for API call details. JQ331 appreciates the help and finds the discourse_api examples useful. JQ331 then asks if the API can be called from within the Discourse forum and if results can be displayed on the homepage. Falco confirms both are possible using custom themes, referencing the Developer’s guide to Discourse Themes.

I am sorting through the API regarding categories. I see here that I can allow users to be moderators of categories. Is there a way to do this through the API?

If it’s possible, I assume it would be using a post call to create a new cateogory (or put to update a single category), and maybe in the “permission” or “group_permissions”?

And is there sample javascript code for making the call?

You can use How to reverse engineer the Discourse API to learn the API call format.

Thanks. That link linked to the gem, including this example file, which is really helpful.

I’m really grateful for all the help the team and community have given me as I sort through things. Discourse is just an awesome example of what open source software and a supportive software community can be.

The API is really fun to use. Sorry for the newbie question, but: Is there a way that I can:

  1. Call the Discourse API from my Discourse forum (for example, call the API when a user hits a button on the forum), and then
  2. Display some of the API results on my discourse forum (such as call “get categories” in the API and then display the resulting category listing on my forum’s home page)?

Yes, both are possible with custom themes. Read Developer’s guide to Discourse Themes to learn more about it.