Change a connected database. Tested first; a failed test changes nothing
const url = 'http://localhost:11044/api/v1/learn/databases/example';const options = { method: 'PUT', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>', 'Content-Type': 'application/json'}, body: '{"engine":"example","fields":{"additionalProperty":"example"},"jdbcUrl":"example","password":"example","username":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”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
Request Bodyrequired
Section titled “Request Bodyrequired”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
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
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
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
A complete JDBC URL, for a caller that has one. Used only when engine is absent or blank, and then 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
The login the world reads the database as. With engine, a non-blank value takes precedence over fields.username
Example generated
{ "engine": "example", "fields": { "additionalProperty": "example" }, "jdbcUrl": "example", "password": "example", "username": "example"}Responses
Section titled “Responses”Unreachable, bad credential, no driver, or an empty schema
A refusal carrying only its explanation, with no code to branch on
object
What went wrong, written to be shown. Carries the underlying driver’s or parser’s own message where there is one
Example generated
{ "error": "example"}Not a database this user connected
A refusal carrying only its explanation, with no code to branch on
object
What went wrong, written to be shown. Carries the underlying driver’s or parser’s own message where there is one
Example generated
{ "error": "example"}
