Uploading Data Sources #
In this guide, we will walk through the process of uploading data sources to your chatbot using the Chatsistant API.
Prerequisites #
Before you begin, make sure you have the following:
- An API key for accessing the Chatsistant API.
- A development environment or tool for making HTTP requests, such as Curl or a programming language like Python.
API Endpoint #
The API endpoint for uploading data sources to your chatbot is: https://app.chatsistant.com/api/v1/chatbot/{uuid}/data-source/url
. Make sure to replace {uuid}
with the UUID of your chatbot.
Request Body #
To upload a data source, you need to send a POST request to the API endpoint with a JSON request body containing the URL of the data source. Here’s an example request body:
{
"url": "https://example.com/data-source"
}
Example Requests #
Here are example commands to upload a data source using the Chatsistant API:
Curl #
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{"url": "https://example.com/data-source"}' \
"https://app.chatsistant.com/api/v1/chatbot/{uuid}/data-source/url"
Python #
import requests
url = 'https://app.chatsistant.com/api/v1/chatbot/{uuid}/data-source/url'
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <token>'
}
data = {
"url": "https://example.com/data-source"
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 200:
print("Request successful!")
print(response.json())
else:
print("Request failed with status code:", response.status_code)
print(response.text)
JavaScript (Axios) #
const axios = require('axios');
const url = 'https://app.chatsistant.com/api/v1/chatbot/{uuid}/data-source/url';
const headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <token>'
};
const data = {
"url": "https://example.com/data-source"
};
axios.post(url, data, { headers })
.then(response => {
console.log('Request successful!');
console.log(response.data);
})
.catch(error => {
console.error('Request failed:', error);
});
That’s it! You’ve now learned how to upload data sources to your chatbot using the Chatsistant API.