Tabular Weather API
Purpose
The Tabular Weather API delivers current and predicted location-based weather conditions in different temporal resolutions.
Request data
HTTPS method: GET
- Constants and parameters enclosed in curly brackets { } must be replaced with their values.
- Please see the following Request parameters section with the required and optional parameters tables for their values. The generic request format is as follows.
Plain GET
messages must be used to create requests.
URL format
https://{baseURL}/weatherconditions/{versionNumber}/{regionCode}?key={Your_API_Key}
URL example
https://api.tomtom.com/weatherconditions/v1/world?key={Your_API_Key}
curl command example
curl 'https://api.tomtom.com/weatherconditions/v1/world?key={Your_API_Key}'
Request parameters
The following table describes the parameters that can be used in a request.
- Required parameters must be used or the call will fail.
- Optional parameters may be used.
Note: There are no optional parameters in this endpoint.
Required parameters | Description |
---|---|
string | Base URL for calling TomTom services. Value: |
string | The version of the service to call. Value: |
string | The name of the product region. See the
Region Coverage for supported
Value: |
string | Authorization key for access to the API. Value: Your valid API Key. |
Request headers
Note: There are no required headers in this endpoint - all are optional.
Header | Description |
---|---|
Requests that the response is compressed in the specified way. The service supports HTTP compression if desired. Currently, only gzip is supported. Value: | |
Provides the entity-tag (E-tag) of the requested resource as last
received by the client. Allows efficient updates of cached information
with a minimum amount of transaction overhead: The service can respond
with a Value: Example: | |
Specifies the time stamp of the last actual update of the requested
resource received by the client. Allows the service to respond with a
Value: Example: |
Response data
The weather conditions are served in a Protobuf
format according to this schema.
Although the structure defined in
the schema allows wrapping the
provided content for all known locations and supported InfoType
s into a single TabularWeather
message.
The binary content delivered by this feed follows a different convention:
- On root level,
the content of a response contains exactly one
MetaData
message and a list ofLocation
messages (in order). - Each
Location
message can contain multiple messages of the typeWeatherInfoList
each containing multipleWeatherInfo
messages of a specificInfoType
, i.e.,DAY
orPERIOD
.
Thus, for parsing the data:
- Parse a single
MetaData
message from the binary input stream usingMetaData.parseDelimitedFrom(...)
. - Infer the number
n
ofLocation
messages remaining in the binary stream from thenumLocations
attribute of the parsedMetaData
message. - Repeatedly
call
Location.parseDelimitedFrom(...)
forn
times. After that, the end of the data should be reached.
This way of transferring the data has the advantage that the binary data for the provided locations does not have to be transformed to internal Protobuf message data structures for all locations at the same time (which would require a significant amount of memory due to the object overhead).
Instead, only a single Location message data structure has to be kept in memory and can be entirely processed (translated to/from internal data structures) before the next one is parsed/written.
Response codes
Code | Meaning & possible causes |
---|---|
| OK |
| Not Modified: The requested content did not change since the last request, as indicated by the value(s) of the If-Modified-Since and/or or If-None-Match http header fields. |
| Unauthorized: The supplied API key is not valid for this request (or missing). |
| Not Found: The specified path was not valid. At least one of the path parameters was omitted or not entered correctly. If an unsupported or invalid country code was specified, the included response message provides a list of valid available country codes. |
| Internal Server Error: Oops. |
Response headers
Header | Description |
---|---|
The service supports http compression if desired. Currently, only gzip is supported. Value: | |
The format of the served resource. The service always provides data in Protobuf (binary). Value: | |
A timestamp specifying when the response was sent. Can be used by the client in the If-Modified-Since header field of subsequent requests in order to optimize the update procedure. Value: Example: | |
Entity-tag of the served resource. Can be used by the client in the If-None-Match header field of subsequent requests, in order to optimize the update procedure. Value: Example: |
Example response
The following code example is the textual representation of an exemplary response content (in Protobuf text format). Note that any real response content will be encoded in Protobuf binary format which is not that human-readable.
1metaData {2 creationTime: 14290074003 lastUpdateTime: 14290074004 source: "TomTom"5 numLocations: 26}7locations {8 id: 1028046469 longitude: 13.6210 latitude: 52.3711 weatherInfoLists {12 lastChangeTime: 142356786013 type: DAY14 weatherInfos {15 date: "2015-04-14"16 minTemperature: 217 maxTemperature: 618 weatherCode: "D_CL_RAI1"19 windSpeed: 5.220 windDirection: NW21 sunProbability: 322 precipitationProbability: 5523 thunderProbability: 024 precipitation: 0.525 uvIndex: 026 sunRise: "07:32:00"27 sunSet: "17:08:00"28 moonSet: "09:48:00"29 moonPhase: 25030 }31 weatherInfos {32 date: "2015-04-15"33 minTemperature: -234 maxTemperature: 535 weatherCode: "D_OC_____"36 windSpeed: 2.637 windDirection: W38 sunProbability: 039 precipitationProbability: 1840 thunderProbability: 041 precipitation: 0.442 uvIndex: 143 sunRise: "07:30:00"44 sunSet: "17:10:00"45 moonRise: "00:13:00"46 moonSet: "10:15:00"47 moonPhase: 26048 }49 }50 weatherInfoLists {51 lastChangeTime: 142900740052 type: PERIOD53 intervalInHours: 154 weatherInfos {55 dateTime: "2015-04-14T10:00:00Z"56 dateTimeLocal: "2015-04-14T12:00:00"57 temperature: 1258 feelsLike: 1259 weatherCode: "D_CL_____"60 windSpeed: 4.361 windDirection: W62 sunProbability: 2763 precipitationProbability: 264 thunderProbability: 065 precipitation: 0.066 pressure: 102667 relativeHumidity: 5368 uvIndex: 469 }70 weatherInfos {71 dateTime: "2015-04-14T11:00:00Z"72 dateTimeLocal: "2015-04-14T13:00:00"73 temperature: 1374 feelsLike: 1375 weatherCode: "D_CL_____"76 windSpeed: 4.677 windDirection: W78 sunProbability: 2679 precipitationProbability: 280 thunderProbability: 081 precipitation: 0.082 pressure: 102583 relativeHumidity: 4884 uvIndex: 485 }86 }87 name: "Zeuthen"88 country: "DE"89 timeZone: "Europe/Berlin"90}91locations {92 id: 10281081593 longitude: 13.7394 latitude: 52.6395 weatherInfoLists {96 lastChangeTime: 142356786097 type: DAY98 weatherInfos {99 date: "2015-04-14"100 minTemperature: 1101 maxTemperature: 6102 weatherCode: "D_OC_RAI1"103 windSpeed: 5.3104 windDirection: NW105 sunProbability: 1106 precipitationProbability: 50107 thunderProbability: 0108 precipitation: 0.4109 uvIndex: 0110 sunRise: "07:32:00"111 sunSet: "17:07:00"112 moonSet: "09:47:00"113 moonPhase: 250114 }115 weatherInfos {116 date: "2015-04-15"117 minTemperature: -2118 maxTemperature: 3119 weatherCode: "D_CL_____"120 windSpeed: 2.7121 windDirection: W122 sunProbability: 2123 precipitationProbability: 17124 thunderProbability: 0125 precipitation: 0.3126 uvIndex: 1127 sunRise: "07:30:00"128 sunSet: "17:09:00"129 moonRise: "00:13:00"130 moonSet: "10:14:00"131 moonPhase: 260132 }133 }134 weatherInfoLists {135 lastChangeTime: 1429007400136 type: PERIOD137 intervalInHours: 1138 weatherInfos {139 dateTime: "2015-04-14T10:00:00Z"140 dateTimeLocal: "2015-04-14T12:00:00"141 temperature: 10142 feelsLike: 7143 weatherCode: "D_CL_____"144 windSpeed: 4.5145 windDirection: W146 sunProbability: 27147 precipitationProbability: 2148 thunderProbability: 0149 precipitation: 0.0150 pressure: 1026151 relativeHumidity: 55152 uvIndex: 4153 }154 weatherInfos {155 dateTime: "2015-04-14T11:00:00Z"156 dateTimeLocal: "2015-04-14T13:00:00"157 temperature: 11158 feelsLike: 11159 weatherCode: "D_CL_____"160 windSpeed: 4.9161 windDirection: W162 sunProbability: 24163 precipitationProbability: 3164 thunderProbability: 0165 precipitation: 0.0166 pressure: 1025167 relativeHumidity: 49168 uvIndex: 4169 }170 }171 name: "Werneuchen"172 country: "DE"173 timeZone: "Europe/Berlin"174}
Response structure
The MetaData message
A MetaData
message provides the following information as attributes:
Attribute | Description |
---|---|
| The actual time in UTC when the content was created as a UNIX epoch. Protobuf data type: |
| The latest original publication time of the source data for the returned content in UTC as a UNIX epoch that caused any included information to change in comparison to before the respective source update. Protobuf data type: |
| The source of the original data used to create the returned content, usually the name of the 3rd-party provider. Protobuf data type: |
| The number of locations for which weather information is contained in the returned content (can be used for sequential parsing). Protobuf data type: |
The Location Message
A Location
message comprises all provided weather data for a single location plus additional meta
information about the location itself. The following attributes are provided:
Attribute | Description |
---|---|
| A unique (and fixed) identifier that refers to that particular location. Protobuf data type: |
| The geographical longitude of the location as a decimal value between -180 and 180. Protobuf data type: |
| The geographical latitude of the location as a decimal value between -90 and 90. Protobuf data type: |
| A list of WeatherInfoList messages. Each WeatherInfoList message will contain a separate list of WeatherInfo messages of a specific type. Protobuf data type: repeated |
| Name of the location, typically the city, quarter, or admin area, etc. Protobuf data type: |
| The ISO 3166-1 alpha-2 code of the location's country in capital letters, e.g., "DE". Protobuf data type: |
| The time zone string of the location according to the standard time zone database (also known as the Olson database), e.g., "Europe/Berlin". Protobuf data type: |
The WeatherInfoList Message
A WeatherInfoList
message is a container for a list of WeatherInfo
messages of the same type &
interval, providing additional information about the common type & interval, and the last (source
publication-) time the included information was updated. The following attributes are provided:
Attribute | Description |
---|---|
| The latest original publication time of source data when information in this list was changed in UTC as a UNIX epoch. Protobuf data type: |
| The type of |
| Interval in hours between the single WeatherInfo messages contained in
this list. Only set if Protobuf data type: |
| A list of Protobuf data type: repeated |
The InfoType Enum
The InfoType
enum provides all possible values for the type
parameter of a WeatherInfoList
.
Value | Description |
---|---|
| Each |
| Each |
The WeatherInfo Message
A WeatherInfo
message summarizes weather parameters for a certain point in time for the location
in question. All potentially provided weather parameter attributes (depending on the type
of the
containing WeatherInfoList
) are specified & described in the following table.
Weather Codes
The weather codes are defined as a 9-character string with the following basic structure.
<T>_<XX>_<PPP><L>
The single parts have the following meaning.
<T>
- single-letter time-of-day specifier: "D" or "N" for day and night respectively<XX>
- 2-letter sky/cloud status specifier<PPP>
- 3-letter precipitation type specifier<L>
- 1-digit precipitation level specifier
Valid Code Values
The following tables summarize the allowed values for the single parts and their interpretations.
Code | Time of day |
---|---|
| Day |
| Night |
Code | Sky/cloud status |
---|---|
| Clear sky |
| Mist |
| Fog |
| Sand/dust storm |
| Hazy |
| Some clouds |
| Partly cloudy |
| Cloudy |
| Overcast |
| Storm |
| Cyclone |
Code | Precipitation type |
---|---|
| Drizzle |
| Rain |
| Rain Showers |
| (Rain &) Thunderstorm |
| Snow |
| Snow showers |
| Snow & thunderstorm |
| Sleet |
| Sleet showers |
| Sleet & thunderstorm |
| Ice rain |
| Hail |
| Hail showers |
| Hail & thunderstorm |
Code | Precipitation level |
---|---|
| Light |
| Moderate |
| Heavy |
Combination Rules
Both day and night codes can be combined with any other (valid) combination of the other parts.
- The cloud/sky status codes
PC
,CL
,OC
,ST
, andCY
can be combined with all precipitation codes. All other codes are followed by 5 underscores to fill up the entire code to 9 characters. - If no precipitation is present, the weather code is also filled up with 5 underscores after the cloud/sky status.
- If precipitation is present, both type and level must be specified.
- All supported precipitation types can be combined with any valid value for the precipitation level.
Examples
The following codes are valid.
D_CS\_\_\_\_\_
- Day, clear sky - Berlin in summerD_OC_RAI2
- Day, overcast, moderate rain - Bielefeld in summerN_PC_RAT1
- Night, partly cloudy, light thunderstorm - the occasional summer thunderstormD_OC\_\_\_\_\_
- Day, overcast - lucky day for BielefeldD_CY_SNO3
- Day, cyclone, heavy snow - blizzardN_PC_SNO1
- Night, partly cloudy, light snow - white Christmas
The WindDirection Enum
The WindDirection
enum provides all possible values for the windDirection
parameter of a WeatherInfo
. It defines 16 equally distributed compass directions plus one value for "variable" and
one value for "unknown".
Value | Description |
---|---|
| Variable/changing wind directions. |
| Wind from North. |
| Wind from North-North-East. |
| Wind from North-East. |
| Wind from North-East. |
| Wind from East. |
| Wind from East-South-East. |
| Wind from South-East. |
| Wind from South-South-East. |
| Wind from South. |
| Wind from South-South-West. |
| Wind from South-West. |
| Wind from West-South-West. |
| Wind from West. |
| Wind from West-North-West. |
| Wind from North-West. |
| Wind from North-North-West. |
| Wind direction unknown. |
Usage and freshness
The weather conditions are updated regularly, typical frequencies being in the order of 1 hour. Using the support for If-None-Match or If-Modified-Since header fields, higher update request frequencies can be used to minimize the delay between updated information being available in the server and being received by the client.
Region Coverage
Region | RegionCode |
---|---|
World |
|