Prompt API
The Prompt API allows you to manage prompts that are used to generate SQL queries and natural language responses. This API provides endpoints for creating, retrieving, updating, and deleting prompts.
Endpoints
1. Create a Prompt
Endpoint: /api/v1/prompts
Method: POST
Request Body:
{
"text": "string",
"db_connection_id": "string",
"schemas": ["string"],
"context": [{"key": "value"}],
"metadata": {"key": "value"}
}Description: Creates a new prompt with the specified text, database connection ID, optional schemas, context, and metadata.
Response:
{
"id": "string",
"text": "string",
"db_connection_id": "string",
"schemas": ["string"],
"context": [{"key": "value"}],
"metadata": {"key": "value"},
"created_at": "string"
}2. Retrieve All Prompts
Endpoint: /api/v1/prompts
Method: GET
Description: Retrieves a list of all prompts.
Response:
3. Retrieve a Specific Prompt
Endpoint: /api/v1/prompts/{prompt_id}
Method: GET
Description: Retrieves the details of a specific prompt identified by prompt_id.
Response:
4. Update a Prompt
Endpoint: /api/v1/prompts/{prompt_id}
Method: PUT
Request Body:
Description: Updates the details of an existing prompt identified by prompt_id.
Response:
5. Delete a Prompt
Endpoint: /api/v1/prompts/{prompt_id}
Method: DELETE
Description: Deletes a specific prompt identified by prompt_id.
Response:
Example Usage
Creating a Prompt
To create a new prompt, send a POST request to /api/v1/prompts:
Request:
Response:
Retrieving All Prompts
To retrieve a list of all prompts, send a GET request to /api/v1/prompts:
Request:
Response:
Retrieving a Specific Prompt
To retrieve a specific prompt, send a GET request to /api/v1/prompts/{prompt_id}:
Request:
Response:
Updating a Prompt
To update a prompt, send a PUT request to /api/v1/prompts/{prompt_id}:
Request:
Response:
Deleting a Prompt
To delete a prompt, send a DELETE request to /api/v1/prompts/{prompt_id}:
Request:
Response:
Last updated