Get weather information from the OpenWeatherMap service
Extend your product feed with weather information using the OpenWeatherMap data service in Productsup.
Introduction
The OpenWeatherMap data service is a Productsup feature that lets you access the OpenWeather API to add current weather conditions or weather forecasts to your product feed. This data can help you customize images or export weather-relevant product offers.
Using the location data in your product feed, the OpenWeatherMap data service retrieves location-relevant weather data. If you choose to retrieve a basic set of current weather details, the data service adds the following columns to your site:
___open_weather_map_last_updated
shows a Unix timestamp of the last run of the data service.___open_weather_map_1_forecast_time
displays weather data creation time as a Unix timestamp.___open_weather_map_1_temp_avg
contains the current average temperature at the location.___open_weather_map_1_humidity
stores the current humidity percentage at the location.___open_weather_map_1_weather_main
gives a simple weather summary, such asClear
orSnow
.___open_weather_map_1_clouds
provides the cloudiness percentage at the location.
Note
The OpenWeatherMap data service is available for the import and intermediate stages.
Prerequisites
To set up the OpenWeatherMap data service, you need:
A product identifier. See Set a product identifier.
A column in your feed containing location data to let the data service retrieve relevant weather data.
This location data can have the following formats:
OpenWeatherMap city IDs.
Tip
To find the needed city IDs, you can download a JSON file with all OpenWeatherMap city IDs. See Built-in API request by city ID to find the file link in the Parameters section.
City names and country abbreviations.
Note
Country abbreviations should consist of two (2) characters and follow the standard ISO 3166-1 alpha-2.
Postal codes and country abbreviations.
Note
Country abbreviations should consist of two (2) characters and follow the standard ISO 3166-1 alpha-2.
Latitude and longitude.
An API key to authenticate in the Weather API. You need to request or purchase it from OpenWeatherMap. See Weather API.
Add the OpenWeatherMap data service
Go to Data Services from your site's main menu and select ADD SERVICE.
Search for OpenWeatherMap, select Add, and give it a desired name and column prefix.
By default,
___open_weather_map
is the column prefix.Choose the stage containing your location data in Service Data Level and select Add.
If you choose Import, the drop-down lists in Step 6 display the columns of your import stage. If you choose Intermediate here, these drop-down lists display your intermediate-stage columns.
In API key, enter your Weather API key.
In Forecast, choose what type of weather data you want to import:
Current weather conditions.
A weather forecast for the next five (5) days.
A weather forecast for the next 16 days.
In Location type, choose what type of location data you have in your feed.
When you choose a specific type of location data, additional fields appear on the data service setup page as follows:
Location data type
Additional fields appear
Expected input
OpenWeatherMap city id
OpenWeatherMap city ID column
Select which column in your feed has city IDs.
City name & country abbreviation
City name column
Select which column in your feed has city names.
Country column
Select the column with country codes.
Postal code & country
Postal code column
Select the column with your postal codes.
Country column
Choose which column contains country codes.
Latitude & Longitude
Latitude column
Choose the column with latitude data.
Longitude column
Choose the column with longitude data.
Number of cities around the point
Enter the number of cities at the identified location.
In Weather data, choose what data you want to retrieve:
Basic returns a simple weather description with temperature, humidity, and cloudiness information.
All returns all weather information available to the Weather API, such as day and night temperatures, minimum and maximum daily temperatures, morning and evening temperatures, atmospheric pressure, humidity, wind speed and direction, cloudiness, a simple weather description, and a detailed weather description.
Select the desired metric system in System of measurement for the platform to use for all measurable weather data retrieved via the Weather API:
Metric
Imperial
International System of Units
Text-based weather descriptions are available in a selection of languages. Select the desired option in Language.
If you want the platform to run the data service every time there is a refresh in Data View, select the checkmark icon (✔) in Trigger during a refresh of the Data View.
Select Save.
For the platform to process a new data service, select Import or Run in the top-right corner of your site's view.
Note
If you can't see the columns that the OpenWeatherMap data service added to your feed in Data View, ensure the platform hasn't hidden them:
Go to Data View from your site's main menu and choose the relevant stage or export in the drop-down list on your left.
Select the menu icon on the right and then select the eye icon.
Find the attributes in the list that use the custom prefix
___open_weather_map
and select the eye icon next to each attribute you want Data View to display.Close the pop-up menu.
The naming of the attributes created by the OpenWeatherMap data service depends on the column prefix you chose in Step 2. The attribute names that the data service generates always start with three underscores (
___
), which means the platform doesn't send those attributes to your export channels.
Edit the OpenWeatherMap data service
Go to Data Services from your site's main menu.
Search for your data service.
Select the cogwheel icon (⚙) next to the desired data service to edit settings.
Select Save.
Delete the OpenWeatherMap data service
Go to Data Services from your site's main menu.
Select the cogwheel icon (⚙) next to the desired data service.
In the Danger Area panel, select Remove this service.
Select Yes.