Contentful is a headless, API-first CMS. It is a content infrastructure which allows you to create, manage and distribute content to any platform. Unlike a CMS, we can create our own content model so you can decide which content you want to manage. This tool uses RESTful APIs to deliver your content across multiple channels such as websites, mobile apps (iOS, Android and Windows Phone) and any other platforms.

These are the four REST API’s you can use to build your app with contentful

  • Content delivery API: It is a read-only API, a big cluster of servers and CDN’s are responsible for delivering content to users devices, as well as the API which enables requesting the exact content which need to be delivered.
  • Content management API: It is a write API, an another server cluster which takes care of processing and storing the incoming content. There is an API on top, using which apps can put their data into Contentful.
  • Content Preview API: It is used to retrieve content that is still unpublished.
  • Images API: It is used to retrieve and apply transformations to images.

Why Contentful over other CMS

The content management systems are created around one type of content to display, mostly to display for a website. Where as contentful follows the strategy “Create once and publish anywhere”. It has a three step process

  • Define a content model which is independent from any presentation layer that defines what kind of content to manage.
  • Editors can manage all of the content in easy and interactive editing interface
  • Display the content in a presentation-independent way, publishing  across many platforms.



How to get started with Contentful

Create a Space:

log in to Contentful’s web app, select the API’s tab and then website key. On this page you can see your ‘space id’ and ‘API keys’.

  • Create a sample space for your project.

  • Open, and replace the values of SPACE_ID and ACCESS_TOKEN with your new values.

  • Close all running instances of the app and re-run gradle run to update the app with the newest changes.

Note: Creation of a space may result in additional charges if the free spaces available in your plan are exhausted.

Steps for Creating a Contentful Website

1. Create your Content Model:

The content model consists of creating content types that will accept only certain types of data for entry.

Above figure shows the predefined fields used to configure data while creating a content model.

2. Add Entries and Assets:

Entries refer to the content. We can add the content with previously created content model. We can also add Assets like images, sounds, videos any other files.

Links: Links are a powerful way to model relationships between content. You can use a URI query parameter with the Contentful search to retrieve an entire chain of related content to display in your application. Entries can have link fields which point to other entries or assets.

Images:  Contentful has a separate Images API that helps you add and retrieve image files in spaces, and also offers manipulation features to make images look how you want.

3. Deliver the content with API:

Setup API keys that will determine which content will go to which platform. After delivery is setup, hitting the publish button will make the content available.

Here is an example demo page created using Contentful that consists of all products list :

I hope this blog has provided good understanding on headless CMS.

Special thanks to Ravi Sangubotla for his extended help to complete this article.

About The Author

Leave a Reply