# Making a Weather Skin

### DISCLAIMER: This guide is going to assume you've read the [Rainmeter Manual](https://docs.rainmeter.net/manual/) already and have a decent understanding of how skins work. READ THE MANUAL.

## Using the API

Now that you have an API key and the ID for your city of choice, you can get started on a skin. First we need to setup our variables

```
[Variables]
APIKey=(your API key)
CityID=(your city ID)
Units=(imperial/metric)
```

* Plugin in the values you got from the OpenWeather website, and feel free to change the variable names
* Units needs to be either `imperial` or `metric` . For Fahrenheit choose imperial, and for Celsius choose metric

Next we need to use a WebParser Measure to call the API:

```
[MeasureSite]
Measure=WebParser
URL=https://api.openweathermap.org/data/2.5/weather?id=#CityID#&appid=#APIKey#&units=#Units#
RegExp=(?siU)"main":"(.*)".*"temp":(.*),.*"feels_like":(.*),.*"temp_min":(.*),.*"temp_max":(.*),.*"humidity":(.*)}.*"wind":{"speed":(.*),.*"clouds":{"all":(.*)}.*"name":"(.*)".*
UpdateRate=3600
```

* This measure uses the methods detailed [here](https://openweathermap.org/current) to call the OpenWeather API by a City ID:`api.openweathermap.org/data/2.5/weather?id={city id}&appid={your api key}`&#x20;
* We then use a regular expression to take out the most pertinent values such as the temperature, windspeed, etc. There are many more parameters that can be accessed which are detailed [here](https://openweathermap.org/current#current_JSON). Simply change the RegExp to parse different values.

Here's a full example skin (Loading this will do nothing):

{% file src="/files/-M8JGogPbw1H9\_-lFLBs" %}
OpenWeather Example
{% endfile %}

For more help with syntax and making things your own checkout the manual:

* [Help with WebParser](https://docs.rainmeter.net/tips/webparser-tutorial/)
* [Help with RegExp](https://docs.rainmeter.net/manual/skins/option-types/#RegExp)

When distributing your skin, you should not include the city code or API key used in development. Keep your values private, and instead direct end users to get their own.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lfgberg.gitbook.io/rainmeter/making-a-weather-skin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
