This reference covers the APIs for managing database endpoints in Eden-MDBS.
Endpoints are managed database connections. Each endpoint connects to a specific database and can be used for executing queries.
Create a new endpoint connection.
POST /api/v1/endpoints
Content-Type: application/json
Authorization: Bearer <token>| Field | Type | Required | Description |
|---|---|---|---|
endpoint | string | Yes | Unique endpoint identifier |
kind | string | Yes | Database type (postgres, mysql, mongo, redis, cassandra, clickhouse, pinecone, http) |
config | object | Yes | Database-specific configuration |
description | string | No | Endpoint description |
curl http://{host}:8000/api/v1/endpoints \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"endpoint": "my_postgres",
"kind": "postgres",
"config": {
"write_conn": {
"url": "postgresql://user:password@host:5432/database"
}
},
"description": "Production PostgreSQL database"
}'curl http://{host}:8000/api/v1/endpoints \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"endpoint": "my_mysql",
"kind": "mysql",
"config": {
"write_conn": {
"url": "mysql://user:password@host:3306/database"
}
}
}'curl http://{host}:8000/api/v1/endpoints \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"endpoint": "my_mongo",
"kind": "mongo",
"config": {
"db_name": "mydb",
"write_conn": {
"url": "mongodb://user:password@host:27017"
}
}
}'Redis supports both URL format and host/port configuration:
# Using host/port (recommended)
curl http://{host}:8000/api/v1/endpoints \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"endpoint": "my_redis",
"kind": "redis",
"config": {
"write_conn": {
"host": "redis-host",
"port": 6379,
"tls": false
}
},
"description": "Redis cache endpoint"
}'# Using URL format
curl http://{host}:8000/api/v1/endpoints \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"endpoint": "my_redis",
"kind": "redis",
"config": {
"write_conn": {
"url": "redis://host:6379"
}
}
}'{
"status": "success",
"data": {
"id": "my_postgres",
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"kind": "Postgres",
"created_at": "2024-01-15T10:30:00Z"
}
}Get all endpoints in your organization.
GET /api/v1/endpoints
Authorization: Bearer <token>curl http://{host}:8000/api/v1/endpoints \
-H "Authorization: Bearer $TOKEN"{
"status": "success",
"data": {
"endpoints": [
{
"id": "my_postgres",
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"kind": "Postgres",
"created_at": "2024-01-15T10:30:00Z"
},
{
"id": "my_redis",
"uuid": "550e8400-e29b-41d4-a716-446655440001",
"kind": "Redis",
"created_at": "2024-01-15T11:00:00Z"
}
]
}
}Get details of a specific endpoint.
GET /api/v1/endpoints/{id}
Authorization: Bearer <token>curl http://{host}:8000/api/v1/endpoints/my_postgres \
-H "Authorization: Bearer $TOKEN"{
"status": "success",
"data": {
"id": "my_postgres",
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"kind": "Postgres",
"created_at": "2024-01-15T10:30:00Z"
}
}Update an endpoint's configuration.
PATCH /api/v1/endpoints/{endpoint}
Content-Type: application/json
Authorization: Bearer <token>curl http://{host}:8000/api/v1/endpoints/my_postgres \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-X PATCH \
-d '{
"config": {
"write_conn": {
"url": "postgresql://user:newpassword@host:5432/database"
}
}
}'{
"status": "success",
"data": {
"id": "my_postgres",
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"kind": "Postgres",
"updated_at": "2024-01-16T10:30:00Z"
}
}Remove an endpoint.
DELETE /api/v1/endpoints/{id}
Authorization: Bearer <token>curl http://{host}:8000/api/v1/endpoints/my_postgres \
-H "Authorization: Bearer $TOKEN" \
-X DELETE{
"status": "success",
"data": {
"message": "Endpoint deleted successfully"
}
}Verify connectivity to an endpoint.
POST /api/v1/endpoints/{id}/test
Authorization: Bearer <token>curl http://{host}:8000/api/v1/endpoints/my_postgres/test \
-H "Authorization: Bearer $TOKEN" \
-X POST{
"status": "success",
"data": {
"connected": true,
"latency_ms": 15
}
}Each database type uses a specific URL format:
| Database | URL Format |
|---|---|
| PostgreSQL | postgresql://user:pass@host:5432/database |
| MySQL | mysql://user:pass@host:3306/database |
| MongoDB | mongodb://user:pass@host:27017/database |
| Redis | redis://host:6379 or redis://:pass@host:6379 |
| Cassandra | cassandra://user:pass@host:9042/keyspace |
| ClickHouse | clickhouse://user:pass@host:8123/database |
Configure read replicas for load distribution:
curl http://{host}:8000/api/v1/connect/postgres \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"id": "my_postgres",
"config": {
"write_conn": {
"url": "postgresql://user:pass@primary:5432/db"
},
"read_conn": {
"url": "postgresql://user:pass@replica:5432/db"
}
}
}'| Operation | Required Access |
|---|---|
| Connect endpoint | Admin |
| List endpoints | Read |
| Get endpoint | Read |
| Update endpoint | Admin |
| Delete endpoint | Admin |
| Test connection | Read |
{
"error": "Invalid configuration",
"message": "Connection URL is required"
}{
"error": "Connection failed",
"message": "Unable to connect to database: connection refused"
}{
"error": "Not found",
"message": "Endpoint 'my_postgres' does not exist"
}{
"error": "Conflict",
"message": "Endpoint with id 'my_postgres' already exists"
}prod_users_db, staging_cache)