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:
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:
Headers:
Body (JSON):
How to Set Up in Botcraft Pro
-
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
Example Response
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.