If you've found this article useful consider donating.
Hello! In this article I'll be talking about five simple-to-use APIs to help inspire project ideas. The goal of this post is to inspire you to create a project, whether it be simple or complex, and start using APIs.
What Is an API?
Before talking about APIs you can use, I think we should understand what an API actually is and what it does.
API stands for Application Programming Interface. Simply put, an API is what allows programs or services to communicate with other programs or services.
A great example I came across (don't remember the original source) was thinking of an API as a waiter at a restaurant.
So you, the customer, talk to a waiter to get your food. The waiter then talks to the chef who actually makes your food. The chef gives the food to the waiter. Finally, the waiter then gives the food to you.
Unpacking this example, the user (customer) sends a request to an API (waiter). The API (waiter) then talks to the service you want to reach, usually a database (chef). That database (chef) then sends data (food) back to the API (waiter). And finally, the API (waiter) then gives you back data (food).
Great! Now that we know what an API is and have a general understanding of how it works, we can now move on to talking about simple APIs you can use.
Official Joke API
The first API I'll be talking about will the simplest one on the list: The Official Joke API.
This API is extremely simple to use, you basically use a URL to connect to one of the API's endpoints and it returns back data in JSON format. Easy! No need for pesky API keys.
For example, if we wanted a random joke from this API, we would
simply use this URL:
https://official-joke-api.appspot.com/random_joke
and it would return one random joke.
You can also grab more than one joke by using the following URL:
https://official-joke-api.appspot.com/random_ten
. Now,
the API will return 10 random jokes instead of just one.
You can check out the full list of endpoints here.
I built a simple Discord bot using this API. Basically, whenever you give the bot the following command, $joke, it returns one joke. You can check out the source code and images of the bot here. You can also check out a step-by-step guide on how to create the exact same Discord bot here.
Shibe.Online API
The next API I'll be talking about will be the shibes.online API. This is similar to the Jokes API I previously mentioned except instead of giving you back jokes it gives you back shibes. And who doesn't like shibes, am I right?
You can find more info about this API here.
To use this API you simply have to use this URL:
http://shibe.online/api/shibes?count=[1-100]&urls=[true/false]&httpsUrls=[true/false]
and replace every "[]" with a parameter.
An example query would be something like the following:
http://shibe.online/api/shibes?count=100&urls=true&httpsUrls=true
The URL above would give me 100 links to shibe images in JSON format. It would also make sure that all images are URLs and that those URLs use https instead of http because of the true parameters we pass it.
I created a simple website that generates shapes based on user input and I used this API to embed images of shibes inside of those shapes. You can find the source code and images of the website I built here.
A similar project idea would be to create a random number of circles on a page and have shibe images embedded within each of those circles every time a user visits the site. You can also have those circles move around and bounce off the edge of the screen. And if you think that was too easy, you can try adding collision detection between those circles so they bounce off of each other as well as the sides of the screen.
Where the ISS At? API
This API is probably the coolest on this list in my opinion just because you're' able to track the ISS with it. Yes, you read that right, the International Space Station!
You can find more info about the API here.
This API gives you back data about the ISS in JSON format. You use
the following URL
https://api.wheretheiss.at/v1/satellites/25544
to get
back data about the ISS like latitude, longitude, altitude,
velocity, etc.
I built a website that tracks the ISS in real-time every couple of seconds and updates its location marker on a map. You can find images and the source code here. You can also visit the website itself here.
A cooler project you can build with this API is to make a website that notifies you whenever the ISS is overhead your current location.
A similar API you can use if you don't like "Where the ISS At?" is the Open Notify API. It's a little less accurate but it gives you more information like people aboard the ISS as well as its pass times.
PokeAPI
Do you like Pokemon? Did you ever want the power of the pokedex right at your fingertips? Well now you can with this API.
This API gives you back data about Pokemon, their move sets, encounters, evolutions, items, and much more. You can check out the full documentation here.
You can think of this API as a real-life pokedex that contains all the information about Pokemon that you'd ever want.
To use this API and get information about Pokemon, you can use the
following URL
https://pokeapi.co/api/v2/pokemon/[pokemon_name]
. Now
you just replace "[pokemon_name]"
with a Pokemon name
or its respective pokedex id and you'll receive back information
about that Pokemon.
The project I built using this API was quite simple. I wanted to learn a little bit of jQuery and I also wanted to learn about CSS grid. So, I created a website that gets the original 151 Pokemon using jQuery and displays them on the screen using CSS grid. You can find the source code and and an image of the website here.
Open Trivia Database API
Finally we get to the final API on this list, the Open Trivia Database API. The Open Trivia Database is an assortment of trivia questions and answers and it has an API you can use for your own projects.
To use this API, you can go here and fill out their API helper to help you generate a link and get back the data you want.
To get up and running quickly using this API, you can use the
following URL:
https://opentdb.com/api.php?amount=10
to get back 10
random questions and answers based on different categories.
I created a Quiz Game which you can visit and play here. Essentially, whenever you click on a category, it will give you 10 questions based on that category and it keeps track of your overall score. At the end, it tells you how many questions you got right out of 10. You can view the source code and images of this project here.
More APIs
Excited about finding more APIs and possibly even trying out more complex APIs, you can head over to this GitHub repo to check and see a plethora of APIs that are open-source and free to use.
Conclusion
Well that was it for this post. You can use one of the aforementioned APIs to create a project whether it be simple or complex.
Keep in mind that not all APIs are this easy to use. Some require that you dig through their respective documentation to get a hang of how to make API calls. Others require that you use an API key in order to connect to the API.
The APIs I mentioned here don't really require much documentation reading and certainly don't require any pesky API keys which are perfect for beginners.
I hope this post inspired you to pick up an API and create a project with it. As always, thanks for reading and good luck!