Almost every API has a method in place to authenticate requests. You usually have to provide an API key in your requests to get a response.
Requiring authorization allows API publishers to do the following:
Keep in mind how users authorize calls with an API — this is something you usually cover in API documentation. Later in the course we will dive into authorization methods in more detail.
In order to run the code samples in this course, you will need to use your own API keys, since these keys are usually treated like personal passwords and not given out or published openly on a web page. (Even so, if you want to borrow my API keys, you can view them here.)
To get the authorization keys to use the Mashape API, you must sign up for a Mashape account.
On market.mashape.com, click Sign Up in the upper-right corner and create an account.
It’s easiest if you first create an account on GitHub, and then just click SIGNUP WITH GITHUB in the Mashape login window.
In the upper-right corner, click Get the Keys.
If you don’t see the Get the Keys button, make sure you click Applications > Default Application on the top navigation bar first. You may have to horizontally scroll to the right to see the Get the Keys button.
When the Environment Keys dialog appears, click Copy to copy the keys. (Choose the Testing keys, since this type allows you to make unlimited requests.)
Now let’s get the keys for the Aeris Weather API. The Aeris Weather API requires both a secret and ID to make requests.
After you sign up for an account, click Account in the upper-right corner.
Click Apps (on the second navigation row, to the right of “Usage”), and then click New Application.
After your app registers, you should see an ID, secret, and namespace for the app. Copy this information into a text file, since you’ll need it to make requests.
When you’re working with code, you use a text editor (to work in plain text) instead of a rich text editor (which would provide a WYSIWYG interface). Many developers use different text editors. Here are a few choices:
These editors provide features that let you better manage the text. Choose the one you want. (Personally, I use Sublime Text when I’m working with code samples, and Atom when I’m working with Jekyll projects.) Avoid using TextEdit since it adds some formatting behind the scenes that can corrupt your content.
8/91 pages complete. Only 83 more pages to go...
Get new posts delivered straight to your inbox.
© 2017, Tom Johnson