But what does it mean? Many REST APIs give you a response that’s formatted as JSON (JavaScript Object Notation.) The data comes in pairs of keys and values that are colon-separated.
Going back to the example API response above, for the key width
, the value would be 353
.
If you copy the url
value out of that code and load it in your browser, you should see a super adorbs gif or image.
Check out the Dog API documentation (dogumentation?) to learn what else you can do.
Pokemon API
Supposedly, PokeApi handles 17 million requests per month. Gotta serve ‘em all, I guess!
This API only returns data about the Pokemon video game franchise. Since Pokemon has movies, TV shows, and comics it would be overwhelming for one API to cover everything. Even scoped just to the games, PokeApi has over 9,000 different kinds of data in their database.
Let’s try exploring the Pokemon species endpoint. To get a list of all the genderless Pokemon species, you’d call https://pokeapi.co/api/v2/gender/3/.
It returns a long list. TIL, there are currently 104 genderless Pokemon species. 😲 Also, Poke-gender is very complicated and backwards-incompatible between different versions of the game.
PokeApi is open source. You can browse the code or contribute on GitHub.
Fun Translations
How many flavors of geekery can be crammed into one API? Quite a few, as it turns out. Fun translations allows you to translate between English and many other quirky or nerdy languages such as:
- Klingon
- Yoda-speak
- Pig Latin
- Cockney
- Ermahgerd
To try out the translations API in the browser you need to url-encode the text so that any special characters can be universally understood by any server. Good news -- the browser handles this for you.
If you paste “https://api.funtranslations.com/translate/doge.json?text=Good morning” into a browser URL bar, it will turn into “https://api.funtranslations.com/translate/doge.json?text=Good%20morning” when you load the page.
You’ll also see a response that looks like this: