BotCraft Pro 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.
API Endpoint: https://api.openweathermap.org/data/2.5/weather
Method: GET
Headers:
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)
URL:
Headers:
Body (JSON):
Select Data Source: REST API
Method: GET
URL: https://api.openweathermap.org/data/2.5/weather?q=London&appid=YOUR_API_KEY&units=metric
Headers:
Body (JSON):
Chat Model: Choose your preferred model (e.g., GPT-3.5 Turbo)
Embedding Model: Choose your preferred embedding model (e.g., text-embedding-ada-002)
Click Create
A successful response from the OpenWeatherMap API will look something like this:
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.
This setup will allow your bot to fetch and display current weather information for the specified location.