Coding with Max Blog

The Beginner's Guide to APIs + How to Apply & Monetize Them

In this article, we’re going to discuss API’s and address some of the biggest questions surrounding this mysterious acronym:

  • What are APIs & what are they used for?
  • Who has an API?
  • What are the advantages and disadvantages of APIs?
  • What is an API Economy?
  • How to Apply & Monetize an API

Now without further ado, the article:

An Introduction

Here is the story of how I first encountered APIs involving my obsession with coffee + programming. A couple years ago, I was sitting at a packed cafe drinking bad coffee when a random idea struck me.

“A program that uses locating and maybe a map service, as well as custom features, to allow users to be able to chat with others at a nearby cafe to see how packed the cafe was and whether the coffee was any good.”

It’s not a million dollar idea, but it was exciting enough for me to pull out a piece of paper to think about how this idea would pan out.

Wow,” Naive Max thought, “what a simple idea! It’s easy, quick, and fulfills a need.

But as I soon learned, the implementation of the idea was, in reality, complicated, time-consuming and also made me want to cry a little.

Why? Because I would have to set up a full maps service myself to be able to develop the location feature of the program. Yikes. That took Google years to do, and I don’t quite have the resources that Google has.

What to do, what to do? It started to seem like the gap between me and my amazing program idea was stretching further and further into miles and miles of wasteland.

programming challenges gap api

This is the gap that more and more programmers and businesses are starting to come upon, because truly: what do you do if you have an idea but you are lacking data or lacking time or resources to develop a specific capability for your program?

  • Are you going to build up an entire location service yourself? That’d take tremendous resources.
  • Are you going to write your own translation software to automatically translate your own website into 200 languages? Nah.
  • Are you going to go out there and collect every Tweet tweeted in the past one week yourself? That’d take forever.
  • Are you going to set up your own database of all the photos ever uploaded to Instagram? #pleaseno

So what is the solution to this gap that can help you develop your program faster, easier and more effectively?

apis savior.png

What is an API?

An API (Application programming interface) is a service that you can use and integrate into your program to gain access to a great many things such as public user data, dropbox files, interactive maps, flight plans, custom fonts, weather data, etc..

Each API has its own purpose, but there are so many varieties of APIs available that you’ll probably be able to find one out there for you.

What are APIs used for?

APIs are specifically used to gain access to two items: data and services.

APIs for Data

Since data is becoming more and more important for all aspects of our world, it’s also important that the data is stored and organized neatly and efficiently and that it is easy to access. This may not always be the case though. If accessing the data is difficult, it may be possible that you have to gather the data yourself.

This could be in the form of setting up a complicated web-scrape program to grab data from web pages, or even setting up measurements/experiments if the data you’re interested in is physical.

Enter: APIs.

Imagine the difficulty of trying to navigate through Twitter’s constantly expanding twitterverse, and trying to keep up with the latest tweets through having several web-scraps running that are aimed at tracking the updates.

This is a great example where the Twitter API helps tremendously, because Twitter has set up a system that allows easy interaction with its database whilst still maintaining security measures.

You can think of talking to an API like talking to an employee at a help desk. Every API is essentially this help desk employee for that company.

For example, let’s call the Twitter API’s “help desk employee” - Jim.

helpdesk jim.png

It’s Jim’s job to get you the information that you’re looking for. You send a message to Jim asking for something specific, Jim goes into the database to gather the information you requested, and Jim sends a message back with the data you are looking for.

That means you can ask Twitter, through their API (‘Twitter Jim’, if you will), for all the data relevant to the tweets you’re tracking.

You even have the option of filtering for amounts and time-frames. Twitter Jim will then give you all of the information in a compact and easy-to-read package, which vastly reduces the time you need to get your data.

Jim’s such a good dude!

I actually “got to know” Twitter Jim when I was looking to do some cool Data Science projects - I wanted to use Twitter’s API to see if I could make stock market predictions. (You can check out the course I created on that process here, if you’re interested!)

APIs for Services

Now how does it work when API’s allow us to use a feature or service that another entity has already built up?

Well, if you remember my cafe program idea from above, then you’ll remember that I was stuck on the idea of having to build a location service software myself.

Thankfully, because of APIs, I can just implement the Google API. The Google API allows you to just integrate Google Maps with all of its features into your program, without you having to re-create any of it.

All you have to do is tell the Google API what you want and, if that request is within the ability of what it can do, it will respond with the result you’re looking for.

This way, you are able to easily integrate the maps and location services without much fuss, whilst being able to focus on the important and innovative parts of your application.

Who has an API?

Cool. Now that we know what API’s are normally used for, you may be thinking, “That sounds awesome. But are API’s widely available? Who has an API?”

Data or service providing APIs can range from IP location to weather data, all across to things like sports and computer data. If it’s a big enough business for you to want to create an application for it, then someone out there has probably set up some form of API to provide you with the data you’re looking for.

Although many famous online companies now have well known and versatile APIs, such as the Google API, Twitter API, Facebook API, not all APIs have to come from big name companies.

There are also many smaller businesses, or even individuals, who set up an API which provides access to data, or enable interaction with their product that they’ve set up.

Of course, if you really can’t find the data via an API then a web-scrapping solution may be the way to go. If you’re curious about what web-scrapping is or how to do web-scrapping, you can read through my step-by-step blog post on that here.

Advantages of APIs

The main advantage of using an API centers around the fact you don’t need to decipher the web-pages and create custom code to draw out any information. Rather, the web-page has set up an easy communication front between you and it, and all you need to do is ask. If there’s a service set up for it within the API, you’ll very quickly get what you want.

Another advantage is that you don’t need to start from zero creating a feature that has already been created if it is being offered to you through an API. You don’t need to spend time, money, or effort in locating data or existing services to realize your new idea.

So an interesting question may be: why would a company set up an API for you? Why would they go through the hassle of setting up a user-friendly system to make your life easier? What’s in it for them?

Consider all the social media extensions that you are able to add everywhere, linking every social media channel with your accounts. All of these are done through APIs and it’s the company’s way of making integration of itself easier into other products. This, naturally, is great for the company.

Think about how cool it is that you can basically tweet whatever you’re doing from whatever platform you’re using, or that you can share almost anything on facebook, or pin it on Pinterest even if you’re not on the Pinterest website. All of these are the great results of companies setting up and making APIs available.

It seems like a 100% win-win service.

Disadvantages of APIs

When it comes to APIs, you also have to be mindful of specific limitations for the service as well as how you’re using the service.

These are some things to keep in mind when you’re playing around or implementing APIs:

  1. When using an API in your service, you’re very dependent on its functionality. For your application to work, the API must also always be live and working. If the API is changed or disabled, this can have very negative effects on your program, either forcing you to make changes or rendering your program completely useless.

  2. You’re limited in what you can do with the API. This limitation is basically restricted by the services the API has set up. If the API doesn’t provide the option to do a specific thing, you won’t be able to do it, and you’ll need to find another way to set up that part of your application.

  3. They can be faulty. APIs from large companies are usually maintained very well, while smaller APIs are often forgotten, or they may have not been tested or even double-checked. This can occasionally result in an API producing blatantly wrong information. Although this is definitely a rarity, it’s something you should keep in mind when choosing an API to rely on for a certain service. Always double check your data!

  4. They may lack complete documentation. This is again something you’ll probably find with smaller APIs, where it’s just one or two people working on it part-time, and they can’t, or don’t want to, dedicate all of their time to writing down and keeping updated documentation informing users what they can do and how they can do it. In these cases, you’ll probably need to revert to internet searches and find working examples, which you can then adapt to integrate into your product. Although definitely not a big disadvantage, this type of work can be tedious and annoying sometimes, and can get frustrating. This can be particularly frustrating if you want to integrate a large chunk of the API’s ability into your program, but you can’t find any information on how to go about it anywhere.

All in all though, it’s important to take away that APIs can provide services that will make your code and programs so much easier, and can really help speed along your project, or enable access to some new cool or desired features.

Using APIs can help you better focus on the actual tasks at hand, without having to worry about creating things that may otherwise seem near impossible.

APIs are another great way through which programmers share progress, and allow you to innovate rather than having to build up from zero.

What is an API Economy?

APIs are become more and more important in the world as many new fields and industry sectors are popping up, and everything and everyone is producing data. Creating a business around many things just wasn’t possible 30, 20, or sometimes even 10 years ago, simply because it wasn’t thought to be possible or there was no apparent use for it.

Now, however, through social media connecting everything and everyone owning all types of smart devices, basically everything is tracking data and everything can be turned into a business.

A lot of times though, companies that collect the data may not be able to, due to lack of resources or lack of interest, use this data to create a new business, because it’s time-intensive and isn’t guaranteed success.

So what happens?

api beginner guide coding with max python.png

Many business then set up APIs, which allow access to their data or their service, which is open for anyone to use. This will allow anyone interested in the field to start researching and playing with the data.

Some of these projects will combine the data with machine learning techniques to create specialized services that can be sold, others may base their research on the data to create a new product, or some will integrate the APIs service into their own application.

All of this not only provides value to the individuals using the API and their data, but also to the original business itself, where people may talk about the API to each other, making the company more well known with the public, or the business can look and see what projects have been created using their data, and try to apply some of the results themselves.

All of this leads to APIs becoming very popular, and many developers look to use them to fuel their projects, and businesses look to creating them and making them available to the public.

How to Apply an API

There are so many ways you can apply an API; I think the easiest way to illustrate its possibilities is to list some general examples of what APIs for data and services are currently being used for.

What people do with API data:

  • Use it for research to understand how users use the product, this can later lead to finding flaws in efficiency of the product, which can be fixed to create a better product, unveil a use of the product that wasn’t thought about before, opening up a potential new market for the product, or understanding how customers use the product, so new products can be developed that work in tandem with the original.

  • Analyze the data to develop and test models, sometimes even machine learning based, which can be sold as a service - think of business offering analytical services for your marketing campaigns or social media outreach.

  • Combine data from several APIs to have data variables that complement each other, which can then be combined and offered under a new API.

What people do with API services

  • Integrate the product that the API is for into their product; think along the lines of websites that allow you to share blog articles to Facebook, tweet it on Twitter, or pin it to Pinterest.

  • Have it take care of some of the complex features in the product that don’t need to be re-developed, such as I would use Google’s API to take care of the maps and direction services for my hypothetical cafe program.

  • Have it provide access to the original product within your own, such as being able to sign up to websites of programs through logging in with your facebook, or filling out a job application with your LinkedIn account. This also allows for easy synchronization between the product you’re using and products that you already use where you’ve probably filled in a lot of this information already.

How to Monetize an API

There are many ways to monetize APIs, but simply put you just have to apply it in some way and, if people are interested in using whatever you created using the API, you can start putting a price-tag on the product, or have subscription options which provide advanced services.

One important thing to make sure of though is that the founder of the API allows the monetization of a direct application of their API.

For most companies that have APIs, this isn’t a problem and is sometimes even encouraged, but there are some companies which may frown upon the use of their API to make a direct profit. So always double check.

And that’s it! That’s the beginner’s guide to APIs. Go forth and apply these APIs now, young grasshopper.

Curious to see the step-by-step on how to apply an API? Or... watch how it works live in action? 

Check out a live demonstration of the Twitter API + how to get access to tons of tweets in my course on the Twitter API, where I attempt to see if Tweets are able to predict the stock market. (Spoiler: they totally can.)