Instruction API
The Instruction API allows you to manage instructions that guide SQL query generation based on conditions and rules. This API provides endpoints for creating, retrieving, updating, and deleting instructions.
Endpoints
1. Create an Instruction
Endpoint: /api/v1/instructions
Method: POST
Request Body:
{
"db_connection_id": "string",
"condition": "string",
"rules": "string",
"is_default": boolean,
"metadata": {"key": "value"}
}Description: Creates a new instruction with the specified database connection ID, condition, rules, default status, and optional metadata.
Response:
{
"id": "string",
"db_connection_id": "string",
"condition": "string",
"rules": "string",
"is_default": boolean,
"metadata": {"key": "value"},
"created_at": "string"
}2. Retrieve All Instructions
Endpoint: /api/v1/instructions
Method: GET
Description: Retrieves a list of all instructions.
Response:
3. Retrieve a Specific Instruction
Endpoint: /api/v1/instructions/{instruction_id}
Method: GET
Description: Retrieves the details of a specific instruction identified by instruction_id.
Response:
4. Update an Instruction
Endpoint: /api/v1/instructions/{instruction_id}
Method: PUT
Request Body:
Description: Updates the details of an existing instruction identified by instruction_id.
Response:
5. Delete an Instruction
Endpoint: /api/v1/instructions/{instruction_id}
Method: DELETE
Description: Deletes a specific instruction identified by instruction_id.
Response:
Example Usage
Creating an Instruction
To create a new instruction, send a POST request to /api/v1/instructions:
Request:
Response:
Retrieving All Instructions
To retrieve a list of all instructions, send a GET request to /api/v1/instructions:
Request:
Response:
Retrieving a Specific Instruction
To retrieve a specific instruction, send a GET request to /api/v1/instructions/{instruction_id}:
Request:
Response:
Updating an Instruction
To update an instruction, send a PUT request to /api/v1/instructions/{instruction_id}:
Request:
Response:
Deleting an Instruction
To delete an instruction, send a DELETE request to /api/v1/instructions/{instruction_id}:
Request:
Response:
Last updated