Postman is a great cross platform tool for testing API calls and the installer is available at: https://www.getpostman.com/downloads/
We have created two files you can import into Postman that will allow you to quickly test the WeatherLink v2 API.
Download the WeatherLink v2 API Postman collection JSON file. This file contains the information about the different API endpoints like
/current and the various parameters that are required or optional.
Download the WeatherLink v2 API Postman environment JSON file. This file contains the information about your WeatherLink v2 API Key and Secret. This is just a blank template file that you MUST edit in order for everything to function properly.
After downloading the environment file open and edit it with your favorite basic text editor application. Locate and replace the following placeholders:
- ENTER_YOUR_WEATHERLINK_v2_API_KEY_HERE - replace this with your API Key
- ENTER_YOUR_WEATHERLINK_v2_API_SECRET_HERE - replace this with your API Secret
Save the environment file after replacing the API Key and Secret placeholders.
Install and/or start Postman. From the menu select File > Import and browse for the Postman collection file you downloaded in Step 1. Then select File > Import again and browse for the Postman environment file you downloaded and edited.
To use the environment settings that include your API Key and Secret look near the top right corner in Postman. There will be a drop down list that might say “No Environment” if this is a fresh installation of Postman. Click that list and choose the “WeatherLink v2 API” entry to change the Postman environment to use your API Key and Secret.
Under the Collections section expand the WeatherLink v2 API and expand the Metadata folder. Select the “Stations - Get All” item to see the details screen about this API call. On the details page you will see the special placeholders like ``. These are placeholders that tell Postman to refer to the environment variables you imported. If you ever need to change your API Key or Secret do not change the placeholders. Instead edit the environment to have the new values.
In addition to the API Key and API Secret environment variables there are additional environment variables that are calculated on the fly when you make a test call the the API from Postman. These additional environment variables are
Now it’s time to send a test API call. With the “Stations - Get All” detail screen open click the Send button in the upper right corner of Postman.
If you entered the API Key and Secret correctly into the environment then the API call will return with the proper JSON response containing the list of stations your API Key has access to.
The metadata portion of the API supports:
- WeatherLinkIP and other data loggers
- Vantage Connect
- WeatherLink Live
Since the WeatherLink v2 API is still in a beta test phase and only supports fetching weather data for EnviroMonitor and WeatherLink Live devices you will need to select an appropriate station ID to complete this next step.
From the JSON response copy one of the station ID numbers and then select “Current Conditions Data” from the “Weather Data” folder under the “WeatherLink v2 API” collection on the left hand side of Postman. On the “Current Conditions Data” details screen enter the station ID into the “Value” field for the
station-id in the Path Variables section. Then click the Send button to send the API call to get current conditions.