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.
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
The following APIs are currently whitelisted and available for students to use through the TechSmart platform.
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:
- The API base url
- A link to the API's documentation
- 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:
- Register for the API's site using your email
- After registration, wait for the API to email you a key, or information on how to get your key
- Follow the API's documentation for how to use an API key in requests