Get authorization keys
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.
- Why requests need authorization
- Get an OpenWeatherMap API key
- Get the Aeris Weather API secret and ID
- Text editor tips
Why requests need authorization
Requiring authorization allows API publishers to do the following:
- License access to the API
- Rate limit the number of requests
- Control availability of certain features within the API, and more
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.)
Get an OpenWeatherMap API key
To get an authorization key to use the OpenWeatherMap API:
- On https://openweathermap.org/, click Sign Up in the top nav bar and create an account.
- After you sign up, sign in and find your API key from the developer dashboard.
- Copy the key into a place you can easily find it.
Get the Aeris Weather API secret and ID
Now for contrast, let’s get the keys for the Aeris Weather API. The Aeris Weather API requires both a secret and ID to make requests.
- Go to http://www.aerisweather.com and click Sign Up in the upper-right corner.
- Under Developer, click TRY FOR FREE. (The free version limits the number of requests per day and per minute you can make.)
- Enter a username, email, and password, and then click SIGN UP FOR FREE to create an Aeris account. Then sign in.
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.
- In the Add a New Application dialog box, enter the following:
- Application Name: My biking app (or something)
- Application Namespace: localhost
- Click Save App.
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.
Text editor tips
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:
- Sublime Text (Mac or PC)
- TextWrangler or BBedit (Mac)
- WebStorm (Mac or PC)
- Notepad++ (PC)
- Atom (Mac or Windows)
- Komodo Edit (Mac or PC)
- Coda (Mac)
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.
12/101 pages complete. Only 89 more pages to go...
If you would like to contribute back to say thank you for the API documentation course, click the Donate button below. Alternatively, to contribute content, such as a tutorial or a new section, contact me with your ideas. You can also submit a pull request in the GitHub repo to make your contribution. Even if you want to just fix a typo or add a sentence here and there, it's always welcome.
I'd Rather Be Writing Newsletter
Get new posts delivered straight to your inbox.