Skip to content

Change a connected database. Tested first; a failed test changes nothing

PUT
/api/v1/learn/databases/{name}
curl --request PUT \
--url http://localhost:11044/api/v1/learn/databases/example \
--header 'Content-Type: application/json' \
--header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \
--data '{ "engine": "example", "fields": { "additionalProperty": "example" }, "jdbcUrl": "example", "password": "example", "username": "example" }'
name
required
string

Name of the connected database to change, as listed by GET /api/v1/learn/sources; 404 when it is not a database this user connected

The new connection, in the shape POST /api/v1/learn/databases takes: engine with fields, or a jdbcUrl, plus username and password. A blank password keeps the stored one. The connection is introspected first and nothing changes when that fails or finds no tables; a saved change drops the reviews held for this source and rebuilds the world

Media typeapplication/json

How to reach a database, sent to POST /learn/databases: an engine and its form’s fields, as a picker sends them, or a JDBC URL a caller already has

object
engine

An engine id from GET /learn/databases/engines, e.g. postgresql, oracle, duckdb. When given, the URL is composed from fields and jdbcUrl is ignored; absent or blank means jdbcUrl is used. An id this appliance has no driver for is refused 400

string
fields
required

Values for the engine’s form, keyed by each field’s name, username and password among them. A blank value takes the field’s default; a required field left blank with no default is refused 400. Read only with engine

object
key
additional properties
string
jdbcUrl

A complete JDBC URL, for a caller that has one. Used only when engine is absent or blank, and then required

string
password
required

Stored in the user’s wallet, never echoed back and never written to world YAML. With engine, a non-blank value takes precedence over fields.password; empty means no password

string
username
required

The login the world reads the database as. With engine, a non-blank value takes precedence over fields.username

string

Example generated

{
"engine": "example",
"fields": {
"additionalProperty": "example"
},
"jdbcUrl": "example",
"password": "example",
"username": "example"
}

Unreachable, bad credential, no driver, or an empty schema

Media typeapplication/json

A refusal carrying only its explanation, with no code to branch on

object
error
required

What went wrong, written to be shown. Carries the underlying driver’s or parser’s own message where there is one

string

Example generated

{
"error": "example"
}

Not a database this user connected

Media typeapplication/json

A refusal carrying only its explanation, with no code to branch on

object
error
required

What went wrong, written to be shown. Carries the underlying driver’s or parser’s own message where there is one

string

Example generated

{
"error": "example"
}