Datasources API
List All Datasources
curl -X GET \
'https://a.messageflow.ai/api/v1/datasources?tenant_id=123' \
-H 'Authorization: Bearer YOUR_AUTH_TOKEN'
[
{
"id": 1,
"name": "Example Datasource",
"type": "webpage",
"url": "https://example.com",
"status": "active"
}
]
Get Datasource Details
curl -X GET \
'https://a.messageflow.ai/api/v1/datasources/1?tenant_id=123' \
-H 'Authorization: Bearer YOUR_AUTH_TOKEN'
{
"id": 1,
"name": "Example Datasource",
"type": "webpage",
"url": "https://example.com",
"status": "active",
"content": "Example content...",
"metadata": {
"last_updated": "2024-03-20T10:00:00Z",
"size": "1.2MB"
},
"tenant_id": 123
}
Create New Datasource
URL for webpage or file datasources
Content for text datasources
curl -X POST \
'https://a.messageflow.ai/api/v1/datasources?tenant_id=123' \
-H 'Authorization: Bearer YOUR_AUTH_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"datasource": {
"name": "New Datasource",
"type": "webpage",
"url": "https://example.com",
"metadata": {
"description": "Example webpage datasource"
}
}
}'
{
"id": 2,
"name": "New Datasource",
"type": "webpage",
"url": "https://example.com",
"status": "active",
"metadata": {
"description": "Example webpage datasource"
},
"tenant_id": 123
}
Update Datasource
curl -X PUT \
'https://a.messageflow.ai/api/v1/datasources/1?tenant_id=123' \
-H 'Authorization: Bearer YOUR_AUTH_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"datasource": {
"name": "Updated Datasource",
"type": "webpage",
"url": "https://example.com/updated",
"metadata": {
"description": "Updated webpage datasource"
}
}
}'
{
"id": 1,
"name": "Updated Datasource",
"type": "webpage",
"url": "https://example.com/updated",
"status": "active",
"metadata": {
"description": "Updated webpage datasource"
},
"tenant_id": 123
}
Delete Datasource
curl -X DELETE \
'https://a.messageflow.ai/api/v1/datasources/1?tenant_id=123' \
-H 'Authorization: Bearer YOUR_AUTH_TOKEN'
{
"status": "Datasource 1 deleted"
}
HTTP Status Codes
- 200: Success
- 201: Created
- 400: Bad Request
- 401: Unauthorized
- 404: Not Found
- 422: Unprocessable Entity
Datasource Configuration
The datasource configuration includes:
- Name and type
- URL for webpage datasources
- Content for text datasources
- Metadata and status
- Last updated timestamp
- Size information
Datasource Types
- Webpage - External web content
- Text - Direct text content
- File - Uploaded file content
- Database - Database connections