What Are Web APIs?
- Estimated read time: 4 min read
- Written by Chad Campbell on Jun 21st 2013
Web APIs empower developers to interact with software components over HTTP (eg 'the web'). These APIs can be used to knit apps together, connect devices with one another, socialize solutions, and deliver services quicker. To enable these scenarios and others, web APIs are typically exposed in a RESTful manner. These APIs can be complemented with hypermedia to provide relevant information. This post will explain what these items are in more detail and why they're valuable.
Why are Web APIs Valuable?
The internet empowered people to access content from basically wherever they wanted. Now that people have that access, and they're using a wider variety of devices, there is a growing need to access that content how they want. You can almost say that the internet freed us from where we do things, while web APIs can help free us from how we do things. The specific business drivers are just as interesting.
In a 2011 report, Hurwitz & Associates found that companies that use web APIs experienced four primary benefits.
- Increased partner and customer reach of more than 70%.
- Web traffic spikes of more than 70%.
- A 30% improvement in the time it took to bring an idea to market.
- A 30% improvement in the amount of time it took to onboard partners.
These four benefits are hard to ignore. With a better understanding of why web APIs should be considered, we'll switch our focus to learn about some of the core properties of a web API. The first thing to consider is the RESTful nature.
A RESTful Nature
The term REST is used to identify an architectural style that relies on a cacheable, client-server, stateless communication protocol. While that's the technical definition, it might be easier to just think of it as a way of designing how apps talk over the internet. This style has emerged over a 40 year maturation process and follows some basic principles. Those principles are covered in another post.
The reason why REST is important is because it simplifies the process of communicating between different pieces of software. The process is simplified because REST makes finding APIs easier and quicker to understand. Considering one of the reasons you may want to have an API is to get as many developers as possible using it, these two characteristics become extremely important. Another important piece is the hypermedia associated with your web APIs.
Hypermedia informs other apps what actions can be taken on some data. The data we're referring to is the response of a web API request. Traditionally, the response would be a basic, static piece of data. Hypermedia can complement this data can so other apps have an idea of how to interact with it. For instance, if your web API returned a SportsTeam object, you may consider including the following hypermedia:
- Links to Content Outside Your Domain
- A link to the team's logo
- A link to the team's Facebook page
- A link to the team's Twitter profile
- Links to Content Inside Your Domain
- A link to the web API that lists the teams players
- A link to the web API that lists the teams chearleaders
- A link to the form where someone can purchase tickets for a game
By using the links in the hypermedia, third party systems and apps can integrate with your app easier. This creates a tighter bond between you and your customers and partners.
Now that the 'what' and 'why' of hypermedia, REST, and web APIs have been introduced, we can turn our focus to the 'how'. We hope that you found this post informative and valuable. If you have any questions, comments, or other feedback, please provide them below.