Update Data Source
Sprint 3
Update an existing data source configuration. All fields are optional - only provided fields will be updated.
Endpoint
PATCH /api/v1/data-sources/{data_source_id}
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <access_token> |
Content-Type | Yes | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
data_source_id | integer | Yes | Data source ID |
Request Body
{
"name": "Updated PostgreSQL",
"description": "Updated description",
"host": "newhost.example.com",
"port": 5433,
"connection_pool_size": 10,
"connection_timeout": 60,
"tags": ["updated", "production"]
}
Parameters
All fields are optional. Only provided fields will be updated.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | No | Data source name (1-255 characters) |
description | string | No | Description |
host | string | No | Database host |
port | integer | No | Database port |
database_name | string | No | Database name |
schema_name | string | No | Schema name |
connection_string | string | No | Full connection string |
file_path | string | No | Object path in storage for file-based sources (max 1000 characters) |
use_ssh_tunnel | boolean | No | Use SSH tunnel |
ssh_host | string | No | SSH tunnel host |
ssh_port | integer | No | SSH tunnel port |
ssh_username | string | No | SSH username |
ssh_local_port | integer | No | SSH local port |
connection_pool_size | integer | No | Connection pool size |
connection_timeout | integer | No | Connection timeout in seconds |
query_timeout | integer | No | Query timeout in seconds |
max_retries | integer | No | Maximum retry attempts |
schema_auto_refresh | boolean | No | Enable automatic schema refresh |
schema_refresh_interval | integer | No | Schema refresh interval in seconds |
metadata | object | No | Additional metadata |
tags | array[string] | No | Tags for categorization |
Response
Success (200)
{
"success": true,
"data": {
"id": 1,
"organization_id": 1,
"workspace_id": 1,
"name": "Updated PostgreSQL",
"type": "postgresql",
"description": "Updated description",
"host": "newhost.example.com",
"port": 5433,
"database_name": "production",
"schema_name": "public",
"connection_pool_size": 10,
"connection_timeout": 60,
"query_timeout": 300,
"max_retries": 3,
"status": "active",
"tags": ["updated", "production"],
"updated_at": "2024-12-01T11:00:00Z",
"updated_by_user_id": 1
},
"message": "Data source updated successfully"
}
Error Codes
| Status | Code | Description |
|---|---|---|
| 400 | BAD_REQUEST | Invalid request data |
| 401 | UNAUTHORIZED | Invalid or missing authentication token |
| 403 | FORBIDDEN | User is not a member of any organization |
| 404 | NOT_FOUND | Data source not found |
Features
- Partial updates (only provided fields are updated)
- Organization-scoped access control
- Updates
updated_atandupdated_by_user_idautomatically
Example
curl -X PATCH "https://api.rivergen.com/api/v1/data-sources/1" \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated PostgreSQL",
"connection_pool_size": 10
}'
Related Endpoints
- Get Data Source - Get current data source details
- Update Credentials - Update connection credentials separately