Adapting our API 

for multiple platforms
BY ROUVEN WEßLING
Like a CMS… without the bad bits.
Contentful is a content management developer
platform with an API at its core.
How do you consume
news?
At Contentful we had to adapt our APIs
to suite a wide variety of platforms and
use cases. How did we do it?
In the UK newspaper
circulation fell 43%
between 2001 and 2014.
In the US 10% of
subscribers read online.
NEWSPAPER
The old fashioned way.
As of 2016, just 20% of
US adults read print
paper news. Just 5% of 18
to 29-year-olds.
85% of US adults
consume news on digital
devices.
13% consume news only
on desktops/laptops.
42% of adults using both
mobile and desktop
prefer the desktop.
WEB
70% of US adults aged
18-29 prefer or only use
mobile devices.
88% of mobile internet
time is spent in apps.
25% of US smartphone
owners prefer apps; 25%
the mobile web.
MOBILE
All the cool kids do it.
Amazon has sold over 5
million Echos in the US.
CNN got 36.5 million
unique readers from
Apple News in
September 2016.
Sky Sports gets around 1
million daily viewers on
Snapchat Discover.
NEW PLATFORMS
Are you ready for them?
TODAY CONTENT
HAS TO BE MULT-PLATFORM
Consumption behavior is changing.
Companies who can’t adapt will be left behind.
Modular

Built to make content reusable
and channel agnostic.
Microservice
API-driven design allows
powerful integration

with third parties.
Cloud service

Focus on the user experience;
not running the backend
The CMS that enables
developers to serve all platforms.
10
How does that
affect our APIs?
Limitations
Enable developers to present content on all connected platforms.*
The devices might lose its internet
connection at any time.
Offline
Mobile devices might be on a slow or
metered connection.
Bandwidth
Some platforms require the content to
be sent to them.
Push
Embedded platforms have limited
processing power.
Performance
*As long as they support HTTP and JSON
12
Offline
Mobile devices might lose their internet connection at
any time.
SYNC API
• Download all content to the
device
• Store a token that marks the last
content that has been synced
• Next sync; get only changed
content
#!/bin/sh
curl 'https://cdn.contentful.com/spaces/cfexampleapi/sync?
access_token=b4c0n73n7fu1&initial=true'
SYNC API
• Download all content to the
device
• Store a token that marks the last
content that has been synced
• Next sync; get only changed
content
{
"sys": {
"type": "Array"
},
"items": [
{
"sys": {},
"fields": {
"name": {
"en-US": "London"
},
"center": {
"en-US": {
"lon": -0.12548719999995228,
"lat": 51.508515
}
}
}
}
],
"nextSyncUrl": "https://cdn.contentful.com/spaces/cfexampleapi/sync?
sync_token=w5ZGw6JFwqZmVcKsE8Kow4grw45QdybCnV_Cg8OASMKpwo1UY8K8bsKFwqJrw7DDhcKnM2
RDOVbDt1E-wo7CnDjChMKKGsK1wrzCrBzCqMOpZAwOOcOvCcOAwqHDv0XCiMKaOcOxZA8BJUzDr8K-
wo1lNx7DnHE"
}
Push
Unlike the web and mobile apps, some content
platforms require the publisher to provide the content
to them.
www.contentful.com
WEBHOOKS
• Don’t call us; we’ll call you
• Select the events necessary
• Payload contains the entire body
17
Bandwidth
Mobile networks are super fast - but not everywhere.
Enable users to get to content before they get bored.
Images API
• Resize images server side so they are as small as possible.
• When constrained by bandwidth, resize further or reduce the quality.
LOCALES
• Most people never change the
websites/apps language
• Optimize for the common case:
only load for the users current
locale
#!/bin/sh
curl 'https://cdn.contentful.com/spaces/cfexampleapi/entries/nyancat?
access_token=b4c0n73n7fu1&locale=en-US'
curl 'https://cdn.contentful.com/spaces/cfexampleapi/entries/nyancat?
access_token=b4c0n73n7fu1&locale=tlh'
LOCALES
• Most people never change the
websites/apps language
• Optimize for the common case:
only load for the users current
locale
{
"sys": {
"id": "nyancat",
"locale": "en-US"
},
"fields": {
"name": "Nyan Cat",
"bestFriend": {
"sys": {
"type": "Link",
"linkType": "Entry",
"id": "happycat"
}
},
"birthday": "2011-04-04T22:00:00+00:00",
"lives": 1337,
}
}
LOCALES
• Most people never change the
websites/apps language
• Optimize for the common case:
only load for the users current
locale
{
"sys": {
"id": "nyancat",
"locale": "tlh"
},
"fields": {
"name": "Nyan vIghro'",
"bestFriend": {
"sys": {
"type": "Link",
"linkType": "Entry",
"id": "happycat"
}
},
"birthday": "2011-04-04T22:00:00+00:00",
"lives": 1337,
}
}
Performance
Embedded platforms are very different from the
computer we all use.
ADJUST PAYLOAD
• JSON is very lightweight
• Less JSON parses faster than
more JSON
• Only worth it on severely
constrained devices
#!/bin/sh
curl 'https://cdn.contentful.com/spaces/cfexampleapi/entries?
access_token=b4c0n73n7fu1&content_type=cat&select=sys.id,fields.name'
ADJUST PAYLOAD
• JSON is very lightweight
• Less JSON parses faster than
more JSON
• Only worth it on severely
constrained devices
{
"sys": {
"type": "Array"
},
"total": 3,
"skip": 0,
"limit": 100,
"items": [
{
"fields": {
"name": "Nyan Cat"
},
"sys": {
"id": "nyancat"
}
},
{
"fields": {
"name": "Garfield"
},
"sys": {
"id": "garfield"
}
}
]
}
RESOLVE

REFERENCES
• Avoid API requests by fetching
linked resources
• Control over the level of depth
#!/bin/sh
curl 'https://cdn.contentful.com/spaces/cfexampleapi/entries?
access_token=b4c0n73n7fu1&content_type=cat&fields.color=rainbow&include=1'
RESOLVE

REFERENCES
• Avoid API requests by fetching
linked resources
• Control over the level of depth
{
"items": [{
"fields": {
"name": "Nyan Cat",
"color": "rainbow",
"bestFriend": {
"sys": {
"type": "Link",
"id": "happycat"
}
}
}
}],
"includes": [{
"fields": {
"name": "Happy Cat",
"color": "gray",
"bestFriend": {
"sys": {
"type": "Link",
"id": "nyancat"
}
}
}
}]
}
COMPLEX QUERIES
• Avoid API requests with
complex queries
• Search on referenced content
#!/bin/sh
curl ‘https://cdn.contentful.com/spaces/cfexampleapi/entries?
access_token=b4c0n73n7fu1&content_type=cat&limit=1&include=0&

fields.bestFriend.sys.contentType.sys.id=cat&fields.bestFriend.fields.color=rainbow'
COMPLEX QUERIES
• Avoid API requests with
complex queries
• Search on referenced content
{
"sys": {
"type": "Array"
},
"total": 1,
"skip": 0,
"limit": 1,
"items": [
{
"sys": {
"id": "happycat",
"locale": "en-US"
},
"fields": {
"name": "Happy Cat",
"color": "gray",
"bestFriend": {
"sys": {
"type": "Link",
"linkType": "Entry",
"id": "nyancat"
}
},
"lives": 1
}
}
]
}
ROUVEN WEßLING
Twitter: @RouvenWessling
Email: rouven@contentful.com

More Related Content

PDF
Welcome alexa, your personal assistant
PDF
php[world] 2016 - API Mashup - Combining APIs for Fun and Profit
PPTX
Mixx2016_Ануреев_Дмитрий
PPT
Suquet de peix
PDF
Cmsascode
PDF
Tecnicas de evaluacion de proyectos
PDF
PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...
Welcome alexa, your personal assistant
php[world] 2016 - API Mashup - Combining APIs for Fun and Profit
Mixx2016_Ануреев_Дмитрий
Suquet de peix
Cmsascode
Tecnicas de evaluacion de proyectos
PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...

Viewers also liked (10)

PPTX
Twitter Api Mashup
PDF
Kendra Shot List
DOCX
Storyboard title sequence (1)
PPTX
Idioms and fixed expressions (i)
PPTX
Phrasal verbs and Idioms Quiz FCE
PDF
API Days Australia - Automatic Testing of (RESTful) API Documentation
PDF
Indice libro "SEO e SEM Guida Avanzata al Web Marketing" 4° Edizione
PPTX
Open API 발표자료 - 김연수
PDF
Nordic APIs - Automatic Testing of (RESTful) API Documentation
PPTX
CIM Formación - Fitoterapia para los trastornos del sistema nervioso
Twitter Api Mashup
Kendra Shot List
Storyboard title sequence (1)
Idioms and fixed expressions (i)
Phrasal verbs and Idioms Quiz FCE
API Days Australia - Automatic Testing of (RESTful) API Documentation
Indice libro "SEO e SEM Guida Avanzata al Web Marketing" 4° Edizione
Open API 발표자료 - 김연수
Nordic APIs - Automatic Testing of (RESTful) API Documentation
CIM Formación - Fitoterapia para los trastornos del sistema nervioso
Ad

Similar to Adapting our API for multiple platforms (20)

PPTX
Introducing cloud technology & mobile apps development
PDF
distributing over the web
PDF
Web fundamentals
PPTX
Feed Herny developer training : crossplatform and HTML5
PDF
PHP in a mobile ecosystem
PDF
Scalable applications with HTTP
PDF
Don't screw it up! How to build durable API
PDF
Consuming RESTful services in PHP
PDF
Consuming RESTful Web services in PHP
PDF
Building a Great Web API - Evan Cooke - QCON 2011
PPTX
Building Content-Rich Java Apps in the Cloud with the Alfresco API
PDF
Importance of APIs in the Internet of Things
PPTX
Exploring Content API Options - March 23rd 2016
PPT
21 Www Web Services
PDF
Utilizing HTML5 APIs
PDF
Modern Web Applications Utilizing HTML5 APIs
PDF
Rise of the Content Mesh: Webcast with Contentful and Gatsby
PDF
When dispatcher caching is not enough... (extended version)
PPTX
When dispatcher caching is not enough by Jakub Wądołowski
PDF
Restful Web Services Cookbook 1st Edition Subbu Allamaraju
Introducing cloud technology & mobile apps development
distributing over the web
Web fundamentals
Feed Herny developer training : crossplatform and HTML5
PHP in a mobile ecosystem
Scalable applications with HTTP
Don't screw it up! How to build durable API
Consuming RESTful services in PHP
Consuming RESTful Web services in PHP
Building a Great Web API - Evan Cooke - QCON 2011
Building Content-Rich Java Apps in the Cloud with the Alfresco API
Importance of APIs in the Internet of Things
Exploring Content API Options - March 23rd 2016
21 Www Web Services
Utilizing HTML5 APIs
Modern Web Applications Utilizing HTML5 APIs
Rise of the Content Mesh: Webcast with Contentful and Gatsby
When dispatcher caching is not enough... (extended version)
When dispatcher caching is not enough by Jakub Wądołowski
Restful Web Services Cookbook 1st Edition Subbu Allamaraju
Ad

More from Rouven Weßling (7)

PDF
API Days Paris - Automatic Testing of (RESTful) API Documentation
PDF
API World 2016 - API Mashup - Combining for Fun and Profit
PDF
vienna.js - Automatic testing of (RESTful) API documentation
PDF
vienna.html - Turn your Blog into Facebook Instant Articles + Contentful Intro
PDF
Static Analysis of PHP Code – IPC Berlin 2016
PDF
What is the Joomla Framework and why do we need it?
KEY
Joomla Day DK 2012
API Days Paris - Automatic Testing of (RESTful) API Documentation
API World 2016 - API Mashup - Combining for Fun and Profit
vienna.js - Automatic testing of (RESTful) API documentation
vienna.html - Turn your Blog into Facebook Instant Articles + Contentful Intro
Static Analysis of PHP Code – IPC Berlin 2016
What is the Joomla Framework and why do we need it?
Joomla Day DK 2012

Recently uploaded (20)

PPTX
Trending Python Topics for Data Visualization in 2025
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PDF
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
PDF
Salesforce Agentforce AI Implementation.pdf
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PDF
Microsoft Office 365 Crack Download Free
PPTX
GSA Content Generator Crack (2025 Latest)
DOC
UTEP毕业证学历认证,宾夕法尼亚克拉里恩大学毕业证未毕业
PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PDF
Practical Indispensable Project Management Tips for Delivering Successful Exp...
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PPTX
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
PDF
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PDF
novaPDF Pro 11.9.482 Crack + License Key [Latest 2025]
PDF
Website Design Services for Small Businesses.pdf
PPTX
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
Trending Python Topics for Data Visualization in 2025
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
Salesforce Agentforce AI Implementation.pdf
Advanced SystemCare Ultimate Crack + Portable (2025)
Microsoft Office 365 Crack Download Free
GSA Content Generator Crack (2025 Latest)
UTEP毕业证学历认证,宾夕法尼亚克拉里恩大学毕业证未毕业
Wondershare Recoverit Full Crack New Version (Latest 2025)
Practical Indispensable Project Management Tips for Delivering Successful Exp...
How Tridens DevSecOps Ensures Compliance, Security, and Agility
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
Weekly report ppt - harsh dattuprasad patel.pptx
novaPDF Pro 11.9.482 Crack + License Key [Latest 2025]
Website Design Services for Small Businesses.pdf
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev

Adapting our API for multiple platforms

  • 1. Adapting our API 
 for multiple platforms BY ROUVEN WEßLING
  • 2. Like a CMS… without the bad bits. Contentful is a content management developer platform with an API at its core.
  • 3. How do you consume news? At Contentful we had to adapt our APIs to suite a wide variety of platforms and use cases. How did we do it?
  • 4. In the UK newspaper circulation fell 43% between 2001 and 2014. In the US 10% of subscribers read online. NEWSPAPER The old fashioned way. As of 2016, just 20% of US adults read print paper news. Just 5% of 18 to 29-year-olds.
  • 5. 85% of US adults consume news on digital devices. 13% consume news only on desktops/laptops. 42% of adults using both mobile and desktop prefer the desktop. WEB
  • 6. 70% of US adults aged 18-29 prefer or only use mobile devices. 88% of mobile internet time is spent in apps. 25% of US smartphone owners prefer apps; 25% the mobile web. MOBILE All the cool kids do it.
  • 7. Amazon has sold over 5 million Echos in the US. CNN got 36.5 million unique readers from Apple News in September 2016. Sky Sports gets around 1 million daily viewers on Snapchat Discover. NEW PLATFORMS Are you ready for them?
  • 8. TODAY CONTENT HAS TO BE MULT-PLATFORM Consumption behavior is changing. Companies who can’t adapt will be left behind.
  • 9. Modular
 Built to make content reusable and channel agnostic. Microservice API-driven design allows powerful integration
 with third parties. Cloud service
 Focus on the user experience; not running the backend The CMS that enables developers to serve all platforms.
  • 11. Limitations Enable developers to present content on all connected platforms.* The devices might lose its internet connection at any time. Offline Mobile devices might be on a slow or metered connection. Bandwidth Some platforms require the content to be sent to them. Push Embedded platforms have limited processing power. Performance *As long as they support HTTP and JSON
  • 12. 12 Offline Mobile devices might lose their internet connection at any time.
  • 13. SYNC API • Download all content to the device • Store a token that marks the last content that has been synced • Next sync; get only changed content #!/bin/sh curl 'https://cdn.contentful.com/spaces/cfexampleapi/sync? access_token=b4c0n73n7fu1&initial=true'
  • 14. SYNC API • Download all content to the device • Store a token that marks the last content that has been synced • Next sync; get only changed content { "sys": { "type": "Array" }, "items": [ { "sys": {}, "fields": { "name": { "en-US": "London" }, "center": { "en-US": { "lon": -0.12548719999995228, "lat": 51.508515 } } } } ], "nextSyncUrl": "https://cdn.contentful.com/spaces/cfexampleapi/sync? sync_token=w5ZGw6JFwqZmVcKsE8Kow4grw45QdybCnV_Cg8OASMKpwo1UY8K8bsKFwqJrw7DDhcKnM2 RDOVbDt1E-wo7CnDjChMKKGsK1wrzCrBzCqMOpZAwOOcOvCcOAwqHDv0XCiMKaOcOxZA8BJUzDr8K- wo1lNx7DnHE" }
  • 15. Push Unlike the web and mobile apps, some content platforms require the publisher to provide the content to them.
  • 16. www.contentful.com WEBHOOKS • Don’t call us; we’ll call you • Select the events necessary • Payload contains the entire body
  • 17. 17 Bandwidth Mobile networks are super fast - but not everywhere. Enable users to get to content before they get bored.
  • 18. Images API • Resize images server side so they are as small as possible. • When constrained by bandwidth, resize further or reduce the quality.
  • 19. LOCALES • Most people never change the websites/apps language • Optimize for the common case: only load for the users current locale #!/bin/sh curl 'https://cdn.contentful.com/spaces/cfexampleapi/entries/nyancat? access_token=b4c0n73n7fu1&locale=en-US' curl 'https://cdn.contentful.com/spaces/cfexampleapi/entries/nyancat? access_token=b4c0n73n7fu1&locale=tlh'
  • 20. LOCALES • Most people never change the websites/apps language • Optimize for the common case: only load for the users current locale { "sys": { "id": "nyancat", "locale": "en-US" }, "fields": { "name": "Nyan Cat", "bestFriend": { "sys": { "type": "Link", "linkType": "Entry", "id": "happycat" } }, "birthday": "2011-04-04T22:00:00+00:00", "lives": 1337, } }
  • 21. LOCALES • Most people never change the websites/apps language • Optimize for the common case: only load for the users current locale { "sys": { "id": "nyancat", "locale": "tlh" }, "fields": { "name": "Nyan vIghro'", "bestFriend": { "sys": { "type": "Link", "linkType": "Entry", "id": "happycat" } }, "birthday": "2011-04-04T22:00:00+00:00", "lives": 1337, } }
  • 22. Performance Embedded platforms are very different from the computer we all use.
  • 23. ADJUST PAYLOAD • JSON is very lightweight • Less JSON parses faster than more JSON • Only worth it on severely constrained devices #!/bin/sh curl 'https://cdn.contentful.com/spaces/cfexampleapi/entries? access_token=b4c0n73n7fu1&content_type=cat&select=sys.id,fields.name'
  • 24. ADJUST PAYLOAD • JSON is very lightweight • Less JSON parses faster than more JSON • Only worth it on severely constrained devices { "sys": { "type": "Array" }, "total": 3, "skip": 0, "limit": 100, "items": [ { "fields": { "name": "Nyan Cat" }, "sys": { "id": "nyancat" } }, { "fields": { "name": "Garfield" }, "sys": { "id": "garfield" } } ] }
  • 25. RESOLVE
 REFERENCES • Avoid API requests by fetching linked resources • Control over the level of depth #!/bin/sh curl 'https://cdn.contentful.com/spaces/cfexampleapi/entries? access_token=b4c0n73n7fu1&content_type=cat&fields.color=rainbow&include=1'
  • 26. RESOLVE
 REFERENCES • Avoid API requests by fetching linked resources • Control over the level of depth { "items": [{ "fields": { "name": "Nyan Cat", "color": "rainbow", "bestFriend": { "sys": { "type": "Link", "id": "happycat" } } } }], "includes": [{ "fields": { "name": "Happy Cat", "color": "gray", "bestFriend": { "sys": { "type": "Link", "id": "nyancat" } } } }] }
  • 27. COMPLEX QUERIES • Avoid API requests with complex queries • Search on referenced content #!/bin/sh curl ‘https://cdn.contentful.com/spaces/cfexampleapi/entries? access_token=b4c0n73n7fu1&content_type=cat&limit=1&include=0&
 fields.bestFriend.sys.contentType.sys.id=cat&fields.bestFriend.fields.color=rainbow'
  • 28. COMPLEX QUERIES • Avoid API requests with complex queries • Search on referenced content { "sys": { "type": "Array" }, "total": 1, "skip": 0, "limit": 1, "items": [ { "sys": { "id": "happycat", "locale": "en-US" }, "fields": { "name": "Happy Cat", "color": "gray", "bestFriend": { "sys": { "type": "Link", "linkType": "Entry", "id": "nyancat" } }, "lives": 1 } } ] }