5 Simple-To-Use APIs for Beginners
Tags: beginners, webdev, codenewbie, tutorial
Published: 2020-02-10 00:47:26

*[If you've found this article useful, consider donating.](https://www.patreon.com/alanjc)*

<a href="https://blog.alanjc.com/articles/5-simple-to-use-apis-for-beginners.html"><i>This article was originally published on my blog.</i></a>

<p>
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.
</p>

<h3>What Is an API?</h3>

<p>
    Before talking about APIs you can use, I think we should understand what an API actually is and what it does.
</p>

<p>
    API stands for Application Programming Interface. Simply put, an API is what allows programs or services to communicate with other programs or services.
</p>

<p>
    A great example I came across (don't remember the original source) was thinking of an API as a waiter at a restaurant.
</p>

<p>
    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.
</p>

<p>
    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).
</p>

<p>
    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.
</p>

<h3><a class="underline" href="https://github.com/15Dkatz/official_joke_api"
                                target="_blank">Official Joke API</a></h3>

<p>
    The first API I'll be talking about will the simplest one on the list: <a class="underline" href="https://github.com/15Dkatz/official_joke_api" target="_blank"> The Official Joke
                                API</a>.
</p>

<p>
    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.
</p>

<p>
    For example, if we wanted a random joke from this API, we would simply use this URL:
    <code>https://official-joke-api.appspot.com/random_joke</code> and it would return one random joke.
</p>

<p>
    You can also grab more than one joke by using the following URL:
    <code>https://official-joke-api.appspot.com/random_ten</code>. Now, the API will return 10 random jokes instead of just one.
</p>

<p>
    You can check out the full list of endpoints <a href="https://github.com/15Dkatz/official_joke_api#endpoints" class="underline" target="_blank">here</a>.
</p>

<p>
    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 <a href="https://github.com/AlanConstantino/discord-joke-bot" class="underline" target="_blank">here</a>. You can also check out a step-by-step guide on how to create the exact same Discord bot <a href="https://blog.alanjc.com/articles/creating-a-discord-bot-with-python.html" class="underline" target="_blank">here</a>.
</p>

<h3><a href="https://shibe.online/" class="underline" target="_blank">Shibe.Online API</a></h3>

<p>
    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?
</p>

<p>
    You can find more info about this API <a href="https://shibe.online/" class="underline" target="_blank">here</a>.
</p>

<p>
    To use this API you simply have to use this URL:
    <code>http://shibe.online/api/shibes?count=[1-100]&urls=[true/false]&httpsUrls=[true/false]</code> and replace every "[]" with a parameter.
</p>

<p>
    An example query would be something like the following:
    <code>http://shibe.online/api/shibes?count=100&urls=true&httpsUrls=true</code>
</p>

<p>
    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.
</p>

<p>
    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 <a href="https://github.com/AlanConstantino/shiba-shapes" class="underline" target="_blank">here</a>.
</p>

<p>
    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.
</p>

<h3><a href="https://wheretheiss.at/w/developer" class="underline" target="_blank">
                                Where the ISS At? API
                            </a>
                        </h3>

<p>
    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!
</p>

<p>
    You can find more info about the API <a href="https://wheretheiss.at/w/developer" class="underline" target="_blank">here</a>.
</p>

<p>
    This API gives you back data about the ISS in JSON format. You use the following URL
    <code>https://api.wheretheiss.at/v1/satellites/25544</code> to get back data about the ISS like latitude, longitude, altitude, velocity, etc.
</p>

<p>
    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 <a href="https://github.com/AlanConstantino/iss-tracker" class="underline" target="_blank">here</a>. You can also visit the website itself <a href="https://iss.alanjc.com/" class="underline" target="_blank">here</a>.
</p>

<p>
    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.
</p>

<p>
    A similar API you can use if you don't like "Where the ISS At?" is the
    <a href="http://open-notify.org/Open-Notify-API/" class="underline" target="_blank">Open
                                Notify API</a>. It's a little less accurate but it gives you more information like people aboard the ISS as well as its pass times.
</p>

<h3><a href="https://pokeapi.co/" class="underline" target="_blank">PokeAPI</a></h3>

<p>
    Do you like Pokemon? Did you ever want the power of the pokedex right at your fingertips? Well now you can with this API.
</p>

<p>
    This API gives you back data about Pokemon, their move sets, encounters, evolutions, items, and much more. You can check out the full documentation
    <a href="https://pokeapi.co/docs/v2.html/#info" class="underline" target="_blank">here</a>.
</p>

<p>
    You can think of this API as a real-life pokedex that contains all the information about Pokemon that you'd ever want.
</p>

<p>
    To use this API and get information about Pokemon, you can use the following URL
    <code>https://pokeapi.co/api/v2/pokemon/[pokemon_name]</code>. Now you just replace
    <code>"[pokemon_name]"</code> with a Pokemon name or its respective pokedex id and you'll receive back information about that Pokemon.
</p>

<p>
    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 <a href="https://github.com/AlanConstantino/pokemon-jquery" class="underline" target="_blank">here</a>.
</p>

<h3>
                            <a href="https://opentdb.com/api_config.php" class="underline" target="_blank">
                                Open Trivia Database API
                            </a>
                        </h3>

<p>
    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.
</p>

<p>
    To use this API, you can go <a href="https://opentdb.com/api_config.php" class="underline" target="_blank">here</a> and fill out their API helper to help you generate a link and get back the data you want.
</p>

<p>
    To get up and running quickly using this API, you can use the following URL:
    <code>https://opentdb.com/api.php?amount=10</code> to get back 10 random questions and answers based on different categories.
</p>

<p>
    I created a Quiz Game which you can visit and play
    <a href="https://quiz.alanjc.com/" class="underline" target="_blank">here</a>. 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
    <a href="https://github.com/AlanConstantino/quiz-game" class="underline" target="_blank">here</a>.
</p>

<h3>More APIs</h3>

<p>
    Excited about finding more APIs and possibly even trying out more complex APIs, you can head over to this <a href="https://github.com/public-apis/public-apis#index" class="underline" target="_blank">GitHub repo</a> to check and see a plethora of APIs that are open-source and free to use.
</p>

<h3>Conclusion</h3>

<p>
    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.
</p>

<p>
    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.
</p>

<p>
    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.
</p>

<p>
    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!
</p>