Brokoli
API Reference

Connections API

CRUD operations for connections with encrypted password storage.

CRUD operations for connections. Passwords are encrypted at rest and never returned in responses.

List connections

curl http://localhost:8080/api/connections
[
  {
    "id": "uuid-123",
    "conn_id": "prod-postgres",
    "type": "postgres",
    "host": "db.example.com",
    "port": 5432,
    "schema": "analytics",
    "login": "etl_user",
    "password": "",
    "created_at": "2024-01-10T12:00:00Z",
    "updated_at": "2024-01-15T08:30:00Z"
  }
]

Passwords are always empty in list responses. The extra field is also omitted from lists.

Pagination

curl "http://localhost:8080/api/connections?page=1&per_page=20"

Get connection

curl http://localhost:8080/api/connections/{conn_id}

Returns the connection with password masked as ******** and extra decrypted.

Create connection

curl -X POST http://localhost:8080/api/connections \
  -H "Content-Type: application/json" \
  -d '{
    "conn_id": "prod-postgres",
    "type": "postgres",
    "host": "db.example.com",
    "port": 5432,
    "schema": "analytics",
    "login": "etl_user",
    "password": "secret123",
    "extra": "{\"sslmode\": \"require\"}"
  }'

Returns 201 Created. The conn_id must be unique (slug format).

Update connection

curl -X PUT http://localhost:8080/api/connections/{conn_id} \
  -H "Content-Type: application/json" \
  -d '{
    "type": "postgres",
    "host": "new-db.example.com",
    "port": 5432,
    "schema": "analytics",
    "login": "etl_user",
    "password": "new-secret"
  }'

To keep the existing password, send "password": "********" or omit it.

Delete connection

curl -X DELETE http://localhost:8080/api/connections/{conn_id}

Returns 204 No Content.

Test connection

curl -X POST http://localhost:8080/api/connections/{conn_id}/test

Tests actual connectivity (opens a DB connection and pings, or sends an HTTP request):

{"success": true, "message": "Connected successfully (pgx)", "driver": "pgx"}
{"success": false, "error": "connection test failed -- check server logs for details"}

Test has a 5-second timeout.

Connection types

List all available connection types and their fields:

curl http://localhost:8080/api/connection-types
[
  {"type": "postgres", "label": "PostgreSQL", "fields": ["host", "port", "schema", "login", "password"]},
  {"type": "mysql", "label": "MySQL", "fields": ["host", "port", "schema", "login", "password"]},
  {"type": "sqlite", "label": "SQLite", "fields": ["host"]},
  {"type": "http", "label": "HTTP / REST API", "fields": ["host", "port", "login", "password", "extra"]},
  {"type": "sftp", "label": "SFTP / SSH", "fields": ["host", "port", "login", "password", "extra"]},
  {"type": "s3", "label": "Amazon S3", "fields": ["extra"]},
  {"type": "generic", "label": "Generic", "fields": ["host", "port", "login", "password", "extra"]}
]

Usage tracking

Find which pipelines use a connection:

curl http://localhost:8080/api/connections/{conn_id}/used-by

Check this before deleting a connection to avoid breaking pipelines.