Database Connection API
The Database Connection API provides endpoints to manage database connections, including creating, listing, updating, and retrieving database connection details. Below is a guide on how to use these endpoints effectively.
Endpoints
1. Create a Database Connection
Endpoint: /api/v1/database-connections
Method: POST
Request Body:
{
"alias": "string",
"connection_uri": "string",
"schemas": ["string"],
"metadata": {"key": "value"}
}Description: Creates a new database connection with the provided details.
Response:
{
"id": "string",
"alias": "string",
"connection_uri": "string",
"schemas": ["string"],
"metadata": {"key": "value"},
"created_at": "string"
}2. List Database Connections
Endpoint: /api/v1/database-connections
Method: GET
Description: Retrieves a list of all database connections.
Response:
3. Update a Database Connection
Endpoint: /api/v1/database-connections/{db_connection_id}
Method: PUT
Request Body:
Description: Updates the details of a specific database connection identified by db_connection_id.
Response:
4. Delete a Database Connection
Endpoint: /api/v1/database-connections/{db_connection_id}
Method: DELETE
Description: Delete an existing database connection that was identified by db_connection_id.
Response:
Example Usage
Creating a Database Connection
To create a new database connection, send a POST request to /api/v1/database-connections with the required body. For example:
Request:
Response:
Listing Database Connections
To retrieve a list of all database connections, send a GET request to /api/v1/database-connections:
Request:
Response:
Updating a Database Connection
To update an existing database connection, send a PUT request to /api/v1/database-connections/{db_connection_id} with the updated details:
Request:
Response:
Deleting a Database Connection
To delete an existing database connection, send a DELETE request to /api/v1/database-connections/{db_connection_id}:
Request:
Response:
Error Handling
400 Bad Request: The request body is invalid or missing required fields.
404 Not Found: The specified
db_connection_iddoes not exist.500 Internal Server Error: An unexpected error occurred on the server.
Last updated