locomotivecms/documentation

No documentation on how to pull content entries through the api, or in general how to use locomotive as a service

oveddan opened this issue · 12 comments

Often a code base can become a mess when you have a cms, e-commerce platform, and other components jumbled into one app. It's more desirable in this case to keep those platforms separate, and consume then as needed through an API in the public facing application. This keeps the main app thin and flexible.

For those of us who want to use locomotive purely for its content editing, organization, and admin capabilities, and keep it separate from our consuming application, there is no documentation on how to pull content entries through a rest API.

I.E., let's say I want to create a list of classes available at a school in Locomotive. What would be the api call to A) get those list of classes and B) get the content for each class?

There should be some better documentation with examples of consuming Locomotive content from the outside.

An easier solution would be, when creating a content entry in the admin, to display it's publicly accessible url. Same could go for for folders of content entries.

did commented

I agree with you. What would be the best tool for you ? A ruby lib to get content entries from an engine thanks to the API or just an example in the documentation ?

I guess we should start with a short REST documentation and if developers ask for, write a specific gem? I think the REST API is mostly useful when connecting a LocomotiveCMS site with another technology.

Well, it seems like out of the box, the ContentEntries controller supports pulling content as JSON - is this true?

If so - this would be an ideal point for integration. You would be able to call this controller directly from the outside (mobile app, other website, etc).

An example on how to do this in the documentation, or some unit tests, would a good first step - then people (like myself) could create client libraries to consume this content via a GET request.

When you edit/create content entries, a great first step to documentation would be showing on that page the url (permalink) to use to retrieve that content.

Another good api call to document would on how to get a list of content entries under a parent, and also maybe another api call to get info on the structure of that content (in other cms this is called the content template, not sure what this is called in Locomotive since I'm new to it)

@oveddan It looks like you have dig in the rest API, would you be interested in contributing to the documentation on that topic?

@oveddan I'm having difficulties in getting PUT/POST to work via the API; locomotivecms/engine#971. Have you had any luck in getting them to work that could be used as a basis for the documentation?

What is really interesting from a business perspective is that content management as a service has picked up. https://gigaom.com/2014/05/13/contentful-says-its-api-based-content-management-means-create-once-display-anywhere/

I briefly used Contentful and I think Locomotive can give it a run for its money. I would love an interface like this to Locomotive. Locomotive's backend is awesome.

https://github.com/contentful-labs/contentful_middleman

It would certainly make it easier to use Locomotive in larger applications where a straight CMS doesn't quite fit.

@amalagaura Thanks for pointing out Contentful - it's the exact idea I've always thought about, but would be great if there was an open source option. I believe Locomotive can be shaped to have this capability too.

The main concept is:

  • Have a flavor of Locomotive that is an admin and an api - it can be easily installed/deployed by anyone in isolation, in a Docker container for example.
  • The Locomotive would be able to serve content and content metadata (content types, content, image urls, etc) via a rest api. This api is purely pull based (not for editing or updating).
  • A Rails Engine could be built to pull the content from this api into an existing or new application.
  • Sdks could be built in javascript, Swift/Objective C, or other languages to pull content into different platforms.

Advantages:

  • Locomotive CMS can power multiple, independent applications.
  • Locomotive content can be easily integrated into existing applications.
  • Applications can have code deployed independent from the CMS.
  • Locomotive can be consumed on IOS.

What do you think @did @jloosfelt ?

toebu commented

Hi, is there any progress on this or plan to make this a reality? Would be awesome to have this!

did commented
toebu commented

Thanks for the fast reply!
Looks interesting, but that's a Ruby client. It looks like it's backed by a RESTful web service which is what I'm looking for. Is there documentation for that web service?

Seconding the request for an example of how to pull a JSON object of a content entry via REST API.