One Shoe logo

API. What?

How can package delivery service DHL let me know where my package is based on a track and trace code, how can Funda be always up-to-date and how is it, that medical information from Thuisarts.nl is also available on other websites? API’s are the key! In this article we’ll tell you what they are, how they work and why you would use them.

Robin Spoelstra | 27 jun 2019

Have you already heard about API's? I think you do, because they're everywhere! Websites consists of a lot of information, this information is usually entered into a CMS (Content Management System) which fills up a connected database. Valuable information that attracts potential visitors. You can keep this information for yourself, but it can also be shared. An interesting subject, but let’s see how we can retrieve data from an external source ourselves first.

Fetching information with an API

You’re going to have a website created with information from another source. What are your options? You can copy and paste everything by hand, but that would be time consuming. A technical solutions seems more obvious. We can have the website, just like you would normally do, go to an URL and retrieve its information. That information however, is probably polluted with a lot of noise. Let’s give an example: If Apotheek.nl were to show information about low blood pressure from Thuisarts.nl, they only want to show the information about low blood pressure. Not the menu, not the Thuisarts logo nor the footer, css or javascript that comes with it. Would that be possible? It most certainly would! With the Thuisarts’ API.

Communicating with an endpoint

Most of the time an API (Application Programming Interface) is just a regular web page or better: a collection of webpages. Instead of showing those pages with clutter that makes it pretty for a human visitor, data on these pages are tailor made for machines. Have a look at this page with a Chuck Norris joke. The information provided here, is shown as JSON. A way data can be presented. For humans it can be somewhat of a struggle to read, but machines are really into this. And because of this tidied-up presentation of information it can be obtained faster. Instead of calling it a webpage or URL, we call it an endpoint that can be accessed.

So, a machine calls an API by ‘dialing’ the endpoint. The API answers by returning data shaped into JSON. Want to take a guess what kind of information these fictional endpoints would return?
https://oneshoe.nl/api/blogs/newest/5/
https://oneshoe.nl/api/recipes/strawberry/

The website of you package delivery service calls an API of another website. This other website return JSON-data and your package delivery service shows you the content in its own layout. Information that wasn’t available in its own database, is shown now to you fast as lightning. And don’t worry, these API calls can be secured perfectly.

All content external

Let’s assume you don’t have a cloud CMS. All content of your website is present in a local database. How can One Shoe help you to make this data available to an other website or app? For Thuisarts One Shoe has built a site of which a part of the database content is also shared through a secured API. This way the website Apotheek.nl is fed with data originating from Thuisarts.nl. Thuisarts can decide for itself what data is available and to whom. Content can be shared with sites of your own, but from a commerce point of view sharing with other parties might also be appealing. An API makes it all possible.

Unlocking your own data

So we’ve been talking about having some of your website’s content come from external sources. But why not all of it? For a long time it’s been almost a certainty that a website had a database of its own. That’s becoming unnecessary now because of the uprise of content management systems in the cloud, like Prismic and Contentful. Adding a new article? You login to Prismic and enter the article in a modern interface. If someone visits an article page on your website, the website calls the cloud CMS API to retrieve it. Here the API acts like a bridge between the website and the cloud CMS. Using a cloud CMS that matches the needs of your project can save you development hours and therefor money. The cloud CMS can also provide an app with the same data through the same API!

Headless CMS & API

Then there is this buzzword I cannot leave unaddressed in this blog. Headless. A website without a front-end. Probably not the kind of website you’re used to. Usually it is a CMS that puts data into a database and shares its data through an API. There is no frontend to view the data, other than the API. It can be build together with the website’s head (the front-end), but it’s not mandatory.

The front and backend of the website can be developed separately and have the API as a communication bridge between them. Headless shares quite some benefits with a cloud CMS, but it gives you more control regarding the adding of content. Headless can also be useful when you simply want to make your data available to the outside world. It can be a catalyst for innovation, because who knows if there is a creative third party company that combines your data with other API data in a convenient app! Like government agencies do: they don’t share data through a nice looking website, but exclusively through an API.

Do you want to know more about the digital opportunities for your organisation? Check here!