Advanced REST API Topics Module #71 Flashcards
What is a very important task that needs to be completed before releasing it?
It should be load tested.
What is the best way to load test an API?
Create a staging replicate of the production environment.
By what method can we determine who is using our API, limit access to special features etc.
Authentication.
How do API keys work?
It is a string of characters that uniquely identifies you as as a user of the API . The key is passed through every call and the the API will return the data requested.
How is abuse of the API and pricing tiers enforced with an API?
Through limiting of X requests per hour.
Suppose there’s a vast amount of data behind your API, and a request is made for a substantial amount of it, how is the data returned?
All of the data cannot be returned at once so, therefore we returned it by using a technique called pagination.
Once you have a group of users using your API, is it fairly straight forward to make some basic changes to the API.
No, because once users are reliant on a particular way something works, it is difficult to change because the downstream effect is their apps or websites will become broken.
What is the basic concept behind pagination?
Data is broken down into chunks by the programmer who designs the API. Those chunks are arbitrary and the code uses offsets and limiters such as in these examples:
/posts returns the first 100 items /posts?offset=1 returns the items from 101 to 200 /posts?offset=2 returns the items from 201 to 300
/posts?limit=10 returns the first 10 items /posts?limit=10offset=1 returns the items from 11 to 20
The parameter names of course are a convention and you can use the ones you prefer.
If you evolve your API over time making improvements, how can you handle that to avoid breaking client implementations?
By using versioning. You can continue to provide version x and then when you come out with a new release it can be a different version.
Which number do APIs start at?
Version #1
Is backward compatibility even important?
Yes, if you want to keep your users happy.
How can you provide a quick and explicit way to let your users know which version of your API they’re consuming?
By implementing the number right in the URL connection string.
Alternatively you can use a different subdomain for separate versions