Is there an API for adding, updating and deleting content, hopefully REST?
If not, could I add, update and delete content from within a controller?
Then I could simple load some endpoint, say once an hour, to run that controller to sync content.
I think there is not any REST interface that we can use that are supported. But we have used the content API and created our own service on top of that to create the REST API.
Since Enonic is built on Java, I’m sure you could set up a CRON job somehow. Brighter minds than me would have to speak to how it would be done though.
A service is available as a mountable endpoint. Quoting the docs:
Services allow the creation of http endpoints without binding them to specific paths.
If you don’t need an endpoint (if you’re going to trigger this via CRUD, it seems like you might not), services are not the droids you are looking for. Simply create a Java class that does the dirty work for you. Again, I’m not sure how to run code on startup (i.e. register a CRUD operation), but perhaps @tsi or @bwe know?
I have a simple solution run with CRON that post content to our intranet from Enonic XP.
This is my content in that file that runs the REST/SERVICE script.