I’m looking to use Grav as headless completely with interaction through the API. Is it possible to build a wrapper applicaiton that would interact with multiple Grav instances in an API only way to setup websites and modify them too. What level of customization can I do on the sites via the API?
@Marty, This question is too broad to answer with a simple yes/no…
- Did you search the forum? There are about 6 other posts containing “headless”.
- Please share what research you have done and which limitations you see.
I did and I still couldn’t gather much. To rephrase my question and simplify a bit, lets ignore headless. How much of a GRAV website can I manipulate via API? By API, I mean an alternative programmatic interface instead of Adminpanel. I came across this Grav API | Grav Documentation, but I dont think its a typical REST API/endpoint.
@Marty, There is no REST API for Grav. The API chapter in the docs is a overview of Grav’s classes and their methods.
- Admin is a nothing but a (optional) Grav plugin providing a web frontend which submits request to the Grav websites it has been added to. This means anything Admin can, your app can (and more) using the framework provided by Grav, and/or plain PHP.
- Grav’s multi-site functionality allows multiple sites to run on a single Grav installation.
Thanks for explaining it. Can you elaborate more on the framework and/or plain PHP part? The way I see it, if my app manipulates the flat file contents, that should be enough. Is there another way to do it?
@Marty, I’ve used the term “framework” loosely as the library of classes provided by Grav. Most of these classes are documented in the API chapter. It’s nothing but a layer on top of plain PHP, hence the “and/or”.
Everything in Grav (configs, pages) is stored in flat files, which can be manipulated by any app - with or without using Grav’s classes. Admin is optional and isn’t needed at all. You can manage the entire website using vi, vscode, or any other editor.