We're just looking at potentially using Craft as a CMS to serve up content to a mobile apple/android app. Ideally content would be delivered as JSON and there be some sort of authentication from the app side (like an api key) as some of the content isn't intended to be publicly accessible. Can craft do this?

Many thanks!


This is most likely possible by serving up restful resources that refer to Craft data with some sort of PHP API that you'll need to write. The APIs you write will just need to grab data using Craft's API

As for hiding certain content for mobile (or whatever frontend platform), I'd create a Lightswitch field for section that you can use to signify content that is "mobile only" or whatever you'd like.

BTW - your API doesn't even necessarily need to be in PHP - You can probably use AngularJS or some other JS server-side framework and use Twig templating. Someone correct me if I'm wrong about that... The great thing about Craft CMS is it's frontend-agnostic


I do the same thing for an app, I generate a json when changed are made during the day in craft cms. This is being done in a custom plugin ran by a cronjob. The app then checks if there is a new json on launch and downloads it. I then visualise everything from that json. Images are being synced aswel.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.