What’s an API?
(taken from here) APIs let your product or service communicate with other products and services without having to know how they’re implemented. This can simplify app development, saving time and money. When you’re designing new tools and products—or managing existing ones—APIs give you flexibility; simplify design, administration, and use; and provide opportunities for innovation.
APIs are a simplified way to connect your own infrastructure through cloud-native app development, but they also allow you to share your data with customers and other external users. Public APIs represent unique business value because they can simplify and expand how you connect with your partners, as well as potentially monetize your data (the Google Maps API is a popular example).
In the samples below, the APIs are essentially access layers to other programs data. These APIs allow you to access data that can be used within you own applications.
Typically, to use an API, you may need to sign up with a site/provider, and then register an application (domain), and then generate a set of keys for authorization. To simplify this process for the learning experience, the keys I have created have been shared below. Please note, because they are shared, they are subject to rate limiting and possibly other constraints. They are also subject to change at any time.
Giphy

https://developers.giphy.com/docs/api/
By integrating with GIPHY, the first and largest GIF search engine, you gain free access to our ever-growing content library of GIFs and Stickers — featuring the latest in entertainment, sports, and breaking news from GIPHY’s official content partners.
api_key: ecuEneAlwq4ZY2PGUQl6ckTlH1kPQO7g
Sample:
From here: https://ects-computerprogramming.com/games/giphyapi/
async function loadImageAsync(){
console.log("Using loadImageAsync");
let searchTerms = document.getElementById("searchTerms").value;
imgElem.src = "";
respContainer.innerHTML = "";
let thepromise = await fetch(`https://api.giphy.com/v1/gifs/random?api_key=ecuEneAlwq4ZY2PGUQl6ckTlH1kPQO7g&tag=${searchTerms}&rating=g`);
let resolvedJSON = await thepromise.json();
console.log(resolvedJSON);
if(resolvedJSON.data.type != undefined){
imgElem.src = resolvedJSON.data.images.original.url;
desc.innerHTML = searchTerms;
respContainer.innerHTML = "\n" + JSON.stringify(resolvedJSON.data, null, "\t");
}else{
desc.innerHTML = `${searchTerms} <br> No Gifs found 😢`;
}
}
Pexels

Give your users access to our entire photo and video library without leaving your app or website. It’s free and seamlessly integrates with just a few lines of code.
Authorization Key: 563492ad6f91700001000001a54be4455d7048a681f1cbe4609601fa
Sample:
From here: https://ects-computerprogramming.com/games/giphyapi/pexels.html
fetch("https://api.pexels.com/v1/search?query=" + searchTerms +"&per_page=80",{
headers: {
Authorization: "563492ad6f91700001000001a54be4455d7048a681f1cbe4609601fa"
}
})
.then(resp => {
return resp.json()
})
.then(data => {
console.log(data);
if(data.photos != undefined && data.photos.length > 0){
let idx = Math.floor(Math.random() * data.photos.length);
imgElem.src = data.photos[idx].src.medium;
desc.innerHTML = searchTerms;
respContainer.innerHTML = "\n" + JSON.stringify(data, null, "\t");
}
})
IGDb (Internet Game Database – Managed by Amazon)

https://api-docs.igdb.com/?shell#getting-started
One of the principles behind IGDB.com is accessibility of data. We wish to share the data with anyone who wants to build cool video game oriented websites, apps and services.
Credentials (used twitch):
twitch cliend id: 9vo7274t10jhnionzqn5w9zwbpajka
twitch secret: dblv7jbo3is1u4u65v6k5r5wrkn7rw
{
"access_token": "vvg3uxybyoywi5fc8fr49x0frt386v",
"expires_in": 5617564,
"token_type": "bearer"
}
Sample (php here, but you can use pretty much any language)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.igdb.com/v4/games",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "fields *; limit 500; where id>300000;",
CURLOPT_HTTPHEADER => array(
"Accept: */*",
"Accept-Encoding: gzip, deflate",
"Authorization: Bearer vvg3uxybyoywi5fc8fr49x0frt386v",
"Cache-Control: no-cache",
"Client-ID: 9vo7274t10jhnionzqn5w9zwbpajka",
"Connection: keep-alive",
"Content-Length: 37",
"Content-Type: text/plain",
"Cookie: __cf_bm=j0nQfs0SXJ.xORukNJQ_k0kQ2gQAv8Q49uGtLdU_ih0-1679447395-0-AR6NfCcZisTsADVpkWjj63YfPdFVmM3rpnWp7xyOIS51uKjgZ8Q1xH4TJGSH1wihyJspAsrAWrt/gooHogfiwsc=",
"Host: api.igdb.com",
"Postman-Token: 29dda317-b14f-44e6-81c2-e6b180f943f2,ec34982a-5fdb-480e-9953-66b1b9803c04",
"User-Agent: PostmanRuntime/7.18.0",
"cache-control: no-cache"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
ESPN (no creds needed)

There are many hidden endpoints that you can just find if you look. Here’s a link to a page about using the NFL endpoints. https://ecosystem.ects-cmp.com/2023/03/15/making-a-database-from-espns-nfl-api-in-progress/
Here’s a link to other known endpoints: https://gist.github.com/akeaswaran/b48b02f1c94f873c6655e7129910fc3b
Here’s a sample page that used a few of the MLB endpoints: https://ects-computerprogramming.com/games/espn-api-mlb/
Dungeons and Dragons – 5e (no creds needed):

https://5e-bits.github.io/docs/api
I don’t know a lot about D and D, but in searching for a relational database, I came across this API. No key necessary.
Example request (for red dragon info) : https://www.dnd5eapi.co/api/monsters/adult-red-dragon
It’s also nice because it provides sample code in multiple languages for all requests.
MusicBrainz (no creds needed)
Not the flashiest of websites, but it appears to have a lot of content under the hood.
https://musicbrainz.org/doc/MusicBrainz_API
Still needs looked into, but I wanted to note it here.
Here is one sample endpoint for looking up releases from fallout boy: https://musicbrainz.org/ws/2/release?artist=516cef4d-0718-4007-9939-f9b38af3f784&fmt=json&inc=release-groups
Pokemon (pokeapi)

This one is totally free and no creds necessary!
Open Library

No creds necessary: https://openlibrary.org/dev/docs/api/books
Note: to get a cover image, you can use the cover_i property in the following url format (-M means medium, there’s also “S” and “L”):
https://covers.openlibrary.org/b/id/{cover_i}-M.jpg
Rick and Morty API

No creds necessary: https://rickandmortyapi.com/documentation
SWAPI (The Star Wars API)

No creds necessary: https://swapi.dev/documentation
Postman
Postman is not an API itself, but rather a tool you can use to test requests without the trouble of coding it first. It can help you create the request, and then show you the response. It can also show you what that request might look like in many different languages. It is an amazing tool!

