How to Learn About APIs
If you’ve ever worked on a coding project that grew to any size, you know it doesn’t take that long for it to become impossible for any single person to know all its inner workings.
In order to deal with the cognitive limitations of human beings, it becomes necessary to divide the project up into individual components which are developed semi-independently of each other.
Find Your Bootcamp Match
- Career Karma matches you with top tech bootcamps
- Access exclusive scholarships and prep courses
As this process continues the teams working on each component begin to develop their own workflows, code bases, and dynamics. At the extreme, it can become difficult for the various components to work together smoothly.
And yet, if the overall project is to be a success this is precisely what has to happen. Having great backend and front end code written doesn’t do any good if none of it fits together. So how do we get everything to coordinate?
This is a deep question with a deep answer, but today we’re going to focus on just one piece of technology that helps make the modern world of technology possible: Application Programming Interfaces (APIs).
If you’re looking to get into a technology career of any kind, knowing how APIs work is going to be an advantage. They are used all over the place for solving problems of almost every kind.
What is an API?
An Application Programming Interface (API) is a protocol that lets two or more web services connect with each other. APIs define what data a service owns can be retrieved and manipulated by another service. Companies rely on APIs to let developers build on top of their services.
As it turns out, communication isn’t just essential in establishing healthy relationships between human beings. It’s no less important in making sure chunks of code get along. In the introduction I tried to set up my discussion of APIs by noting that within single projects complexity can cross a threshold beyond which there must be established rules for how one component talks to another. Well, the exact same thing is true at a much higher level between projects.
So what we have is a situation in which there needs to be layers both inside and outside a given project whose entire purpose is to make it so that someone can talk to the project’s software in a clear, rule-based way.
And that’s what an API is. One popular example of an API is code which enables you to grab the contents of a web page (I describe just such an API below), but they come in many more shapes.
Twitter has multiple APIs for accessing its database of tweets, which let you do things like search for specific hashtags. SERPapi is a 3rd-party resource that lets you grab Google search results in a JSON object; it returns date time information, text snippets, titles, links, and pretty much everything else Google would. I could write an entire article just expanding this list.
Why Use an API?
I want to start answering this question by first drilling down into an example which is similar to my first experience with an API.
Imagine you’d like to grab the headlines, contents, and metadata for all the articles published by the New York Times in the past 5 years for natural language processing. If you couldn’t do any clever programming, how would you do this?
You’d probably have to set aside a week to spend all your time going backwards through the New York Times’ website, painstakingly copying out the data you need by hand into some kind of database.
Can you conceive of a more ridiculous waste of time?
Luckily, like almost all major websites, media outlets, applications, and software, the New York Times has an API which lets you accomplish this very thing in much less time. If I recall correctly, it took me a few hours of fiddling to get years worth of text data.
With this story having been relayed I doubt much else needs to be said. You use an API for the same reason you use a keyboard or a wheelbarrow or an atlatl: it makes your life easier.
Why Build an API?
And we’ve also gone most of the way towards answering the question from the other side. While I doubt the New York Times cares all that much about whether a fledgling data scientist saves time gathering their articles together. But most other application developers don’t have much choice. If they want their product to be used and integrated with other applications, they have to make an API to facilitate that process.
But there are subtler reasons. It sometimes winds up being possible to utilize applications through APIs in surprising ways that even the developers didn’t foresee. The famous automation platform If This Then That (IFTTT) is basically nothing but a way of lashing together hundreds of APIs to make it possible to do things like automatically email your spouse when you’re still logged into your work machine after a certain time or send out a tweet every time you bookmark an article.
Famously, Amazon began slicing their code up into smaller pieces that became exposed through APIs, which paved the way for what would later become Amazon Web Services, the most powerful cloud-computing service in the word.
Before you can go on to use complicated web APIs, you first need to know the principles upon which APIs are based. These principles will aid your understanding of what information you can retrieve and manipulate with an API. It is also these principles that guide how you get information.
How Long Does it Take to Learn APIs?
It takes a few hours to learn the fundamental concepts behind APIs. This is because the architecture behind APIs is relatively simple if you have a good understanding of the web. You may end up spending days or weeks learning an individual API and what you can do with it.
Let’s take the Twitter API. You could spend days looking through documentation to find all the API endpoints you need for a project. Every API has their own endpoints, authentication mechanisms, and schemas which you’ll need to learn to use that API.
How to Learn APIs: Step-by-Step
How do I learn to use APIs? That’s a great question. The first step is to ask yourself why you want to learn about APIs. This will help keep you motivated even as you encounter challenges which all web developers do when they first start to use APIs.
- Learn the basics of web servers. APIs are run on web servers. Before you set out to learn how to use an API, you should learn how the front-end and back-end work together.
- Learn the principles behind APIs. Spend some time learning about how APIs work and what different architectures are used. Learn about the basics of REST and why it is so popular.
- Practice your skills. Choose a web API that you find interesting and try to make a few API calls. Authenticate yourself as a user and try some GET and POST requests. This will familiarize you with how APIs work on a practical level.
- Build a project. Once you’ve played around with an API, you’ll have the knowledge you need to build a project with that API. You could build an application that analyzes Tweets from Twitter. Or you could use the Stripe API to add payments to a project you have been working on.
The best rule to remember when you are learning APIs is to practice. Nobody develops complete mastery within an hour. It takes time to learn principles and to understand the specifics of an API.
The Best Online API Courses and Trainings
There are plenty of API courses and training programs on the web. Yoy may be asking yourself which ones are worth your time. That’s a good question to ask. Below we have covered some of the best API courses and trainings you can use to accelerate your knowledge of APIs.
"Career Karma entered my life when I needed it most and quickly helped me match with a bootcamp. Two months after graduating, I found my dream job that aligned with my values and goals in life!"
Venus, Software Engineer at Rockbot
Online API Courses
Designing Restful APIs
- Provider: Udacity
- Cost: Free
- Audience: Intermediate
This free course by Udacity teaches the basics of Application Programming Interfaces. You’ll learn how to write secure APIs for a back-end web application. At the end of this course, you’ll create an API for a social application.
This course is expected to take around three weeks to complete for someone who is interested in learning about APIs.
Software Architecture: REST API Design
- Provider: Udemy
- Cost: $50.00
- Audience: Intermediate
You’ll learn how to design a professional REST API and discover how best to document an API in this course.
What’s more, you’ll learn how to correctly describe an API and use the jargon that comes with modern APIs.
This course is best if you already have some basic knowledge of how APIs work and want to expand your understanding of APIs.
REST APIs with Flask and Python
- Provider: Udemy
- Cost: $60.00
- Audience: Intermediate
In this online course, you’ll learn how to work with REST APIs using Python. You’ll work your way through building your own API using Python and Flask, a popular web development framework. This course covers designing and building an API with security in mind.
Online API Books
RESTful Web APIs by Leonard Richardson
This book was written in response to the massive growth of REST APIs. In this book, you’ll learn about what REST is and how it works. This book comes with a step-by-step guide on how to create your own API using REST principles. You’ll also learn about best practices in designing an API.
REST API Design Rulebook by Mark Masse
There are a number of guidelines you should keep in mind when you are designing a REST API. In this book, you’ll learn the basic design rules you should follow in designing a REST API. You’ll learn why REST APIs should be designed and acquire an understanding of modern API best practices.
RESTful API Design by Matthias Biehl
RESTful API design is a complete guide to designing an API using REST principles. In this book, you’ll learn the fundamentals of designing a good API. You’ll also learn how APIs are applied in a commercial development environment.
This book, unlike many, is packed with knowledge on how to manage APIs as a product within a business.
Online API Resources
Learn REST: A RESTful Tutorial
REST, or Representational State Transfer, is a method of designing APIs. In this online tutorial, you’ll learn what REST is, how it works, and why REST Is so important.
APIs for Beginners – How to Use an API
This video by freeCodeCamp introduces you to the basics of APIs. You’ll learn about the fundamental principles behind APIs and why APIs are important. You’ll get opportunities to work with popular web APIs in this course so you can practice your skills.
Insomnia is an open-source API client. It lets you easily design APIs that use the OpenAPI specification. You can use the Insomnia Core product to easily make requests to web interfaces that use either REST or GraphQL. GraphQL is a popular type of API.
Should You Study APIs?
APIs are a crucial part of the web. All websites which connect to other services rely on APIs to some extent. For instance, external applications that let you analyze Tweets rely on the Twitter API.
If you plan to become a web developer, studying APIs is essential. As a back-end web developer, you’ll spend a lot of your time crafting APIs for back-end web services.
If you are a front-end web developer, you may still be expected to work with APIs so you can display information on a web page from another service.
Some Common API Questions.
This could become an entire series of articles by itself. But, there is a small set of typical confusions about APIs which it’s worth addressing.
Is an API a Web Service?
We’ve covered APIs in some detail. A web service is subtly different, facilitating machine-to-machine interaction over a network through the use of a Web Services Description Language (WSDL).
These do look quite similar, and the biggest distinction to be made is that web services are a subset of APIs. While every web service is an API, there are APIs which are not web services. Web services require a network and must adhere to a specific design protocol, but there are APIs which can work offline, and they can be built in accordance with any protocol.
What Is a RESTful API?
Building an API according to Representational State Transfer (REST) principles has been compared to using Graphical User Interfaces; so common that most people don’t even realize there are alternatives. REST APIs were introduced by Roy Fielding, and they essentially separate client-side concerns from server-side concerns.
This has a few implications. First, client and server applications can evolve independently of each other. Second, the flow of information becomes a matter of requesting and responding. Instead of there being a continuous exchange between them, they don’t communicate unless one of them requests something from the other. Finally, REST APIs can cache information so that they can more quickly produce it if and when it’s required.
This barely scratches the surface, read REST vs Streaming APIs for a more thorough breakdown.
Learning More about APIs
Given how common and powerful APIs are it’s a good idea to at least familiarize yourself with how they’re used and built.
Here are some resources to get you started doing just that.
- If you’d like to build a REST API with Flask or Python, check out this Udemy course.
- An outstanding article laying out historical examples of companies that have succeeded by incorporating APIs. It does a great job of motivating the need for building good interfaces.
- Characteristically, O’Reilly has some books which cover the subject in detail. “APIs: A Strategy Guide” by Jacobson, Brail, and Woods discusses APIs from a business perspective, as potentially profitable long-term investments. “Designing Web APIs” by Jin, Sahni, and Shevat takes a more technical approach to building, scaling, and improving your web API.
APIs are important, and getting more so all the time. If you’d like to truly stand out as you build your technology career, be sure and learn to work with them, write them, and leverage them to add value.
About us: Career Karma is a platform designed to help job seekers find, research, and connect with job training programs to advance their careers. Learn about the CK publication.