R Tutorial: Access tokens and APIs

preview_player
Показать описание

---
As you can see from the previous exercise, API clients are super easy to use: they're just R packages. In the background, they're communicating over the Internet with the API, but that's nicely abstracted away: clients mean you don't have to care what the API is doing, or how it's structured. You can just write R code.

The people who maintain the API, however, absolutely care what your client is doing. If many people are simultaneously trying to get a massive amount of data out of it, that can risk overwhelming the system. As a result, some APIs have access tokens: little per-user or per-session keys that identify the person making the API requests, making it easy for the operators to limit you or shut you down if you're causing problems with their service.

Getting an access token is normally pretty simple, and tends to require registration with the API you're trying to use. An example, and one we're going to play around with, is Wordnik, an online dictionary service that contains a ton of interesting metadata about English-language words. Their service requires an access token to use, which you gain by filling out a form that explains what you're trying to do and giving them your email address so they know who to yell at if you break their service.

Now you'll try an example using the birdnik package, which wraps the Wordnik API. This gives you information about English words, such as the frequency that it is used.

The API key is just a random string of letters and numbers that is unique to you. To use it, you just pass it as an argument to the birdnik functions.

Let's try an example.

#DataCamp #RTutorial #Web #Data #API #token
Рекомендации по теме