2

I’d like to use Craft as a headless CMS for my mobile app (via the Element API plugin). However, in addition to reading data, I’d also like to write data back to Craft.

It looks like this is typically done using an Entry Form on the front-end. Is writing to Craft possible without using Craft’s front-end though (e.g. native inputs in the app that send data via the API instead of a web view with an entry form)? If not, could this be accomplished by forking the Element API and adding that functionality somehow?

1

I'd caution against trying to adapt the ElementAPI plugin for this purpose, as it was designed to be read-only—it's basically a wrapper around Craft's ElementQuery interface, which does not handle write operations.

In lieu of that, you might take a look at the CraftQL plugin, by Mark Huot. It supports sophisticated queries (reading), as well as mutations (writing).

Otherwise, if the scope of the content you need to update is relatively narrow (i.e. you know what section and fields you need to use), I'd recommend reading through the plugin docs, and determining whether it's something you could build on your own, with a simple Controller and supporting Service(s)!

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.