In a discussion titled ‘Controlling Theme Components via API?’, kinetiksoft asks whether it’s possible to enable or disable theme components via the Discourse API, noting that ChatGPT suggested a method that returns a 404 error. merefield initially dismisses ChatGPT’s suggestion as fabricated, explaining that components are added or removed from parent themes via a PUT /admin/themes/<id> endpoint with a parent_theme_ids payload — information gleaned from browser network inspection. kinetiksoft responds that this doesn’t seem accessible externally, despite the API key having global scope. Canapin corrects the record, confirming that ‘Enable’ and ‘Disable’ buttons exist in Discourse’s UI for theme components and that API control is indeed possible, referencing a prior post for details. merefield acknowledges the error and clarifies that while ChatGPT was wrong, the functionality is real — just not implemented as described. The consensus is that theme components can be controlled via API, but not via the endpoint or method ChatGPT suggested.
Just wondering if it’s possible to enable/disable theme components via API. It seems like there was a way to do it, but there is no mention of it in current Discourse API Documentation. The clue of such possibility was given by ChatGPT, and yeah, I certainly know this is far from a reliable source of information. I just wonder if this is achievable in any remote way, and the fairy tale ChatGPT told me sounds perfect, but doesn’t work. API returns 404 for admin users’s API credentials.
So as you can see, we aren’t all out of a job yet.
There’s no concept of “enabling” or “disabling” a Theme Component, you simply add or remove it from a parent theme. EDIT: incorrect, see @Canapin’s post below!
ChatGPT made it all up. got the wrong end point and body.
Using the browsers network tab, I can see that adding a Theme Component to a parent theme called a
PUT /admin/themes/<id>
(id of component)
With payload something like:
parent_theme_ids: [<parent_id>]
I didn’t make that up, I just looked at the Network tab on my browser