> ## Documentation Index
> Fetch the complete documentation index at: https://support.myapps.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# BotCraft Pro Adding a Rest API

> BotCraft Pro Adding a Rest API

# Adding a Rest API

Let's use the OpenWeatherMap API as an example. This is a popular weather API that provides current weather data for any location.

### Example: OpenWeatherMap API

API Endpoint: `https://api.openweathermap.org/data/2.5/weather`

Method: `GET`

Headers:

```
json
```

```
{
  "Content-Type": "application/json"
}
```

Query Parameters:

* `q`: The city name (e.g., `London`)

* `appid`: Your API key from OpenWeatherMap

* `units`: Units of measurement (optional, e.g., `metric` for Celsius)

### Example Request

URL:

```
https://api.openweathermap.org/data/2.5/weather?q=London&appid=YOUR_API_KEY&units=metric
```

Headers:

```
json
```

```
{
  "Content-Type": "application/json"
}
```

Body (JSON):

```
json
```

```
{}
```

### How to Set Up in Botcraft Pro

1. Select Data Source: REST API

2. Method: GET

3. URL: `https://api.openweathermap.org/data/2.5/weather?q=London&appid=YOUR_API_KEY&units=metric`

4. Headers:

   ```
   json
   ```

   ```
   {
     "Content-Type": "application/json"
   }
   ```

5. Body (JSON):

   ```
   json
   ```

   ```
   {}
   ```

6. Chat Model: Choose your preferred model (e.g., GPT-3.5 Turbo)

7. Embedding Model: Choose your preferred embedding model (e.g., text-embedding-ada-002)

8. Click Create

### Example Response

A successful response from the OpenWeatherMap API will look something like this:

```
json
```

```
{
  "coord": {
    "lon": -0.1257,
    "lat": 51.5085
  },
  "weather": [
    {
      "id": 800,
      "main": "Clear",
      "description": "clear sky",
      "icon": "01d"
    }
  ],
  "base": "stations",
  "main": {
    "temp": 15.5,
    "feels_like": 14.8,
    "temp_min": 14.0,
    "temp_max": 17.0,
    "pressure": 1015,
    "humidity": 72
  },
  "visibility": 10000,
  "wind": {
    "speed": 3.09,
    "deg": 240
  },
  "clouds": {
    "all": 0
  },
  "dt": 1624531200,
  "sys": {
    "type": 2,
    "id": 2019646,
    "country": "GB",
    "sunrise": 1624508400,
    "sunset": 1624564800
  },
  "timezone": 3600,
  "id": 2643743,
  "name": "London",
  "cod": 200
}
```

Replace `YOUR_API_KEY` with your actual API key from OpenWeatherMap. If you don't have an API key, you can sign up for one [here](https://home.openweathermap.org/users/sign_up).

This setup will allow your bot to fetch and display current weather information for the specified location.
