Mobile backend as a service

How to get rid of the boring parts of mobile development

SlackbotMobile1

Getting content into your apps can be hard work. Not only do you have to keep track of how to communicate with all kinds of databases, you also need to know how the bits and pieces that make up your backend fit together to produce something useful…at least, that’s how it used to be.

But with the arrival of Mobile backend as a service, or MBaaS, things just got a lot easier. With MBaaS you don’t need to worry about any of the backend stuff. Because whatever kind of data you need for your app — just make an API-call and your content will be there in no time.

This guide explains the benefits of using Contentfuls content infrastructure for enterprise mobile application development and how we can make your mobile app backend as efficient as possible.

Table of contents

It’s all REST APIs

With our MBaaS approach, content is all about API calls. So if you know how to work with REST APIs, then you already know the basics of Contentful. Whether the content you store with Contentful is text, images, 3D models or any other type of data — you just need to issue an API call to one of our four APIs and the content will come flying your way immediately.

Our four APIs

We currently have four APIs. The four APIs are:

  • Content Delivery API (CDA) — The API that your apps use to pull in your published content.
  • Content Management API (CMA) — Enables users to upload data to the Contentful infrastructure platform.
  • Content Preview API — Lets you preview content drafts so that you can see what that content will look like in your app once you hit the publish button. The content preview API is ideal for staging environments.
  • Images API — Lets users not only retrieve but also manipulate images. Notable features include image cropping, resizing and format conversion.

How the APIs connect to our CDN

Our Content Delivery Network, or CDN, is designed to make sure that your users are always as close as possible to an access nodes. This will make your apps feel fast and snappy. Another benefit of using our CDN is that you don’t have to think about the architecture that delivers content to your applications — call our APIs and we’ll make sure to provide you with your content on time.

REST APIs make coding fun

As a developer, you probably like coding more than having to sort out scalability issues. And you probably prefer making sure that your code is as good as it can be — rather than planning the infrastructure supporting your next release.

Our REST APIs free you from having to worry about how the content-delivering backend architecture fit together

Our REST APIs free you from having to worry about how the content-delivering backend architecture fit together. This, in turn, allows you to focus on building apps that your users like. Because let’s face it: you customers don’t care about your backend stack — what they care about is a good user experience.

It’s also possible to go beyond plain REST API calls and use GraphQL. Check out our guide Running GraphQL queries in Contentful guide for more information.

Develop and release faster with MBaaS

APIs add a layer of abstraction between your application and the backend systems that it communicates with. A well-structured API lets this abstraction speed up your development and release cycles.

Since the API endpoints are the only points of communication, developers don’t need to spend time figuring out how to communicate with various backend systems over different protocols and formats. All you need is HTTP GET or POST methods and the data will be returned to you as JSON.

How your app communicates with the Content Delivery API

With Contentful, all your content gets stored in so called spaces. A space can be seen as a repository for structured data.

So let’s say that you run a bookstore for developers. This means that you most likely have thousands of books to offer your customers. And to keep track of all your books you have created a space called developer_bookshelf — and that space contains information on each book (like its author and its title).

The API way of getting this information into your app would be to send the following HTTP GET request to the Contentful Content Delivery API:

https://cdn.contentful.com/spaces/developer_bookshelf/entries/5PeGS2SoZGSa4GuiQsigQu The requests tells the receiving API endpoint to return the entry with the id 5PeGS2SoZGSa4GuiQsigQu from the space called developer_bookshelf.

The JSON response sent back to the app will, in turn, look like so:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
	"sys": {
		"space": {
			"sys": {
				"type": "Link",
				"linkType": "Space",
				"id": "developer_bookshelf"
			}
		},
		"id": "5PeGS2SoZGSa4GuiQsigQu",
		"type": "Entry",
		"createdAt": "2015-12-08T15:45:54.394Z",
		"updatedAt": "2015-12-08T15:45:54.394Z",
		"revision": 1,
		"contentType": {
			"sys": {
				"type": "Link",
				"linkType": "ContentType",
				"id": "book"
			}
		},
		"locale": "en-US"
	},
	"fields": {
		"name": "An introduction to regular expressions. Volume VI",
		"author": "Larry Wall",
		"description": "Now you have two problems."
	}
}

As we can see from the JSON response above, the REST API returned a good amount of information about the book we asked for. So all we have to do in our app to display this data is to work our way through the JSON and just grab the pieces we want.

So now we know how to get data back in the form of text. But what if your data is more complex than just words? Using Contentful, you decide what data to store and process. For example: some of our customers use the content infrastructure to handle 3D models. Be sure to check out our knowledge base article on integrating VR into your apps.

Only ship new app versions after the code has been changed — not the content

Getting apps approved by app stores can be a less than pleasant experience. Also, having your latest creation checked against the app store’s requirements can take time. Precious time. Sure — if you’ve in some way rewritten the code of your app then it needs to get a new stamp of approval. But if the only change you’ve made to the app is its content then there’s a better way.

Beacuse if you separate code from content as part of your mobile app architecture and rely on a backend service, you’ll never have to build another version of your app again just because you want to ship a content update. All you do is update the content in your space and pull it in into your app with an API call. That is, in a nutshell, how Mobile backend as a service works.

Saving data to your backend

We’ve seen how Contentful can be used to deliver any data to your mobile platform. But most apps require an architecture that allows for information to flow in both directions. This is where the Content Management API, or the CMA, comes in handy. A good introduction to the CMA can be found in the API reference.

Summary

MBaaS is the modern way to connect apps to a backend. Choose Contentful for your Mobile backend as a service infrastructure if you want a simple API-first approach to content management. All your app needs to do in order to pull data from Contentful is make a HTTP GET request, and your data will be returned as JSON. This makes your content platform truly independent and reusable.

But a good user experience is not only about content — it’s also about speed. That’s why we built our CDN to ensure that your users are always close to one of its access nodes.

Separating code and content is a good way to get away from the bad habit of releasing a new version of your app just because you need to update some content. Instead, building your app so that content gets pulled in via API calls lets you devote your release management to code changes.

What’s next

If you are new to Contentful we suggest that you head over to our features page to learn more about what we can do for your next project.

We also recommend that you run though our Contentful in five minutes guide to understand how you can start building your next mobile app with Contentful right away.

Discover Contentful

Learn how Contentful works

Read about our content management infrastructure, our flexible APIs and our global CDN.
View key features

See how our customers use Contentful

From apps and sites to digital signage and iBeacon campaigns — we deliver content everywhere.
Explore other customers