Skip to main content

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

HeaderRequiredDescription
AuthorizationYesBearer <access_token>
Content-TypeYesapplication/json

Path Parameters

ParameterTypeRequiredDescription
data_source_idintegerYesData 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.

FieldTypeRequiredDescription
namestringNoData source name (1-255 characters)
descriptionstringNoDescription
hoststringNoDatabase host
portintegerNoDatabase port
database_namestringNoDatabase name
schema_namestringNoSchema name
connection_stringstringNoFull connection string
file_pathstringNoObject path in storage for file-based sources (max 1000 characters)
use_ssh_tunnelbooleanNoUse SSH tunnel
ssh_hoststringNoSSH tunnel host
ssh_portintegerNoSSH tunnel port
ssh_usernamestringNoSSH username
ssh_local_portintegerNoSSH local port
connection_pool_sizeintegerNoConnection pool size
connection_timeoutintegerNoConnection timeout in seconds
query_timeoutintegerNoQuery timeout in seconds
max_retriesintegerNoMaximum retry attempts
schema_auto_refreshbooleanNoEnable automatic schema refresh
schema_refresh_intervalintegerNoSchema refresh interval in seconds
metadataobjectNoAdditional metadata
tagsarray[string]NoTags 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

StatusCodeDescription
400BAD_REQUESTInvalid request data
401UNAUTHORIZEDInvalid or missing authentication token
403FORBIDDENUser is not a member of any organization
404NOT_FOUNDData source not found

Features

  • Partial updates (only provided fields are updated)
  • Organization-scoped access control
  • Updates updated_at and updated_by_user_id automatically

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
}'