5.4 Web APIs Teacher Guide

Follow

CS202 lesson 5.4 contains all the technical details you will need to know to teach and use APIs, but here is some additional info that will help you with troubleshooting, and give you additional information to help students with projects.

 

RATE LIMITS

Most APIs have built in rate limits, which limit the number of calls a user can make, ensuring that a single user doesn't overload an API. 

Internal rate limits:

When using the TechSmart platform, each account (student and teacher) will have the following rate limits applied:

  • 3 requests per second to same domain
  • 30 requests per minute to same domain
  • 200 requests per hour to same domain
  • 500 requests per day to same domain

External rate limits:

Each external API will have their own rate limit rules. If you are using the TechSmart platform, our internal rate limits will apply, but if the API you or your students choose to use have more strict limits you may hit the limit faster than you would expect. You can check the API's documentation or pricing pages to check what limits are applied.

What happens when you exceed the limit:

If you exceed the limit you will get a 429 Too Many Requests status code. If this happens try waiting a minute before sending any more requests, and make sure that the request isn't being called too many times each time the program is run (I.E. avoid having the API call in a while loop that continuously calls it, and check if multiple API calls could be condensed into a single call)

 

DOMAIN WHITELIST INFO

Whitelisted APIs:

The following APIs are currently whitelisted and available for students to use through the TechSmart platform. 

Name / Description

API Root

Documentation

TVMaze

http://api.tvmaze.com

http://api.tvmaze.com

Bored API

https://www.boredapi.com/api/

https://www.boredapi.com 

TheSportsDB

https://www.thesportsdb.com/api/

https://www.thesportsdb.com/api.php 

Weather.gov

https://api.weather.gov

https://www.weather.gov/documentation/services-web-api 

Recipe Puppy

http://www.recipepuppy.com/api

http://www.recipepuppy.com/about/api/ 

Open Trivia DB

https://opentdb.com/api.php

https://opentdb.com/api_config.php 

Zippopotamus (zip codes)

https://api.zippopotam.us 

https://api.zippopotam.us  

Data.gov

https://api.data.gov/

https://api.data.gov/ 

SWAPI (Star Wars)

https://swapi.dev/api/

https://swapi.dev/ 

CoinMarketCap

https://pro-api.coinmarketcap.com

https://coinmarketcap.com/api/documentation/v1/ 

DnD 5e API

https://dnd5eapi.co/api/

https://dnd5eapi.co 

PokeAPI (Pokemon)

https://pokeapi.co/api/

https://pokeapi.co 

OpenLibrary (books)

https://openlibrary.org

https://openlibrary.org/developers/api 

Teleport (cities)

https://api.teleport.org

https://developers.teleport.org/api/ 

Open Food Facts

https://world.openfoodfacts.org/api/

https://world.openfoodfacts.org/data 

Random User Generator

https://randomuser.me/api/

https://randomuser.me/documentation 

Exchange Rate API

https://v6.exchangerate-api.com/v6/

https://www.exchangerate-api.com/ 

Rest Countries

https://restcountries.eu/rest/

https://restcountries.eu/ 

Data USA

https://datausa.io/api/

https://datausa.io/about/api/ 

Open Movie Database

https://www.omdbapi.com

https://www.omdbapi.com/ 

Adding a new API to the Whitelist:

If you have an API you think should be added to the Whitelist, feel free to reach out to us. Please provide the following information for your API to be considered:

  1. The API base url
  2. A link to the API's documentation
  3. What benefit adding this API to our Whitelist would provide

We cannot guarantee that all requested APIs will be added, but we will look into any that are sent in for consideration.

 

SIGNING UP FOR AN API KEY

Some APIs require a user to sign up for an API key to access the full API. While none of our built in activities will require signing up for an API key, your students may want to for their own personal projects.

If you want, you can also sign up for a key instead, and provide it to your student(s). However, it is good practice for students to go through this signup process themselves, and having multiple students using the same key can quickly max out an API's rate limits.

If students are signing up for their own API keys, guide them through using standard best practices for internet safety when filling out forms, such as choosing secure passwords and not providing too much personal information.

The process for signing up for a key is typically as follows:

  1. Register for the API's site using your email
  2. After registration, wait for the API to email you a key, or information on how to get your key
  3. Follow the API's documentation for how to use an API key in requests
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.