Forgive me if I’ve fallen for buzzwords, but I’m wondering if anyone has done any work with MODX as a headless CMS.
I’ve been messing around with Astro and have been finding it very easy to get into and get sites built, but the CMS offerings don’t have the good feels that MODX does.
Ideally, I would love to be able to query MODX and get the resources as JSON including template variables and such. Is there an extra that exists for this that I’m just not googling for correctly? Or is this something that can be hand rolled with some effort.
You could use the REST API.
The problem is, that with the default controller, the content is returned as stored in the database and therefore unparsed. (Meaning the output still contains MODX tags [[...]]).
You can parse the content in the controller, but you have to call the function yourself.
Also the plugins from other installed extras may not run when using the REST API. An example is an extra that obfuscates all e-mail addresses in the output (on the event OnWebPagePrerender).
You also would have to adapt the code in the controller to output TVs with the rest of the fields.
This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.