openapi: 3.0.1 info: contact: email: support@aiven.io name: Aiven support team url: https://aiven.io/support-services title: Aiven API Documentation Account Service:_MySQL API version: v1 x-logo: altText: Aiven logo backgroundColor: '#fafafa' href: https://api.aiven.io/doc url: https://aiven.io/assets/img/aiven-logo.png description: "# Introduction\n\n[Direct link to openapi.json](https://api.aiven.io/doc/openapi.json) for use with external tools\n\n[Aiven](https://aiven.io) is a modern fully-managed open source data platform for streaming, storing, and analyzing data on any public cloud. On Aiven Platform, you can operate your data infrastructure with a few devops tools: [Aiven Console](https://console.aiven.io/), [Aiven Terraform Provider](https://aiven.io/docs/tools/terraform), [Aiven CLI](https://github.com/aiven/aiven-client), and [Aiven Operator for Kubernetes](https://github.com/aiven/aiven-operator). All of them are built on an open secure powerful REST API for integration with custom tooling.\n\nThe Aiven [REST](http://en.wikipedia.org/wiki/Representational_State_Transfer) API\nprovides programmatic access to Aiven.io services. To call the Aiven API, you can use either CLI tools (for example, `cURL` or [Aiven CLI client](https://aiven.io/docs/tools/cli)) or GUI tools, such as the [Aiven public API Postman collection](https://www.postman.com/aiven-apis).\n\nThis Aiven API documentation will help you operate your Aiven organization, projects, or services programmatically by integrating your applications and processes with Aiven.\n\n# Description\n\nAiven's APIs ([Application Programming Interfaces](https://en.wikipedia.org/wiki/API)) power its platform for data management. Aiven has a number of REST APIs that can help you build strong and robust data infrastructure for your applications.\n\nThe Aiven API is organized around core resources. Each core resource has multiple endpoints, which can be interacted with using different HTTP methods.\n\n## Core resources\n\n### Platform APIs\n\n
This endpoint may be changed or removed at any time. Don't use it in production environments.
parameters: - $ref: '#/components/parameters/account_id' requestBody: content: application/json: schema: $ref: '#/components/schemas/MySQLAccountQueryOptimizeRequestBody' example: do_not_store: true flags: [] mysql_version: '8.4' query: Select email from users; schema_metadata: '{ ''columns'': [...], ''indexes'': [...], ''views'': [...], ... }' responses: '200': description: Response content: application/json: schema: $ref: '#/components/schemas/MySQLAccountQueryOptimizeResponse' '400': description: Invalid request parameters content: application/json: schema: type: object properties: message: type: string title: Human readable error message errors: type: array title: List of error details. Typically there is only one element items: type: object properties: message: type: string title: Human readable error message error_code: type: string enum: - optimization_failed - unable_to_parse_query title: Machine processable error code. Clients must be prepared to handle new codes. description: 'optimization_failed: The service was unable to optimize the SQL query. unable_to_parse_query: The service could not parse the query due to syntax errors or unsupported expressions' '404': description: Resource not found content: application/json: schema: type: object properties: message: type: string title: Human readable error message errors: type: array title: List of error details. Typically there is only one element items: type: object properties: message: type: string title: Human readable error message error_code: type: string enum: - account_not_found title: Machine processable error code. Clients must be prepared to handle new codes. description: 'account_not_found: No such account exists' security: - tokenAuth: [] oauth2: - accounts:read /mysql/database-metadata-query: get: summary: Retrieve metadata query for MySQL database tags: - Service:_MySQL operationId: MySQLServiceDatabaseMetadataQuery x-badges: - name: Experimental position: after color: '#787885' x-experimental: true description:
This endpoint may be changed or removed at any time. Don't use it in production environments.
responses: '200': description: Response content: application/json: schema: $ref: '#/components/schemas/MySQLServiceDatabaseMetadataQueryResponse' /mysql/query/metadata-validate: post: summary: Validate schema metadata structure and statistics tags: - Service:_MySQL operationId: MySQLServiceMetadataValidate x-badges: - name: Experimental position: after color: '#787885' x-experimental: true description:
This endpoint may be changed or removed at any time. Don't use it in production environments.
requestBody: content: application/json: schema: $ref: '#/components/schemas/MySQLServiceMetadataValidateRequestBody' example: db_version: '16' metadata: '{ ''columns'': [...], ''indexes'': [...], ''views'': [...], ... }' responses: '200': description: Response content: application/json: schema: $ref: '#/components/schemas/MySQLServiceMetadataValidateResponse' '400': description: Invalid request parameters content: application/json: schema: type: object properties: message: type: string title: Human readable error message errors: type: array title: List of error details. Typically there is only one element items: type: object properties: message: type: string title: Human readable error message error_code: type: string enum: - metadata_validation_failed title: Machine processable error code. Clients must be prepared to handle new codes. description: 'metadata_validation_failed: Metadata validation failed' /project/{project}/service/{service_name}/mysql/query/stats: post: summary: Fetch MySQL service query statistics tags: - Service:_MySQL operationId: MySQLServiceQueryStatistics parameters: - $ref: '#/components/parameters/project' - $ref: '#/components/parameters/service_name' requestBody: content: application/json: schema: $ref: '#/components/schemas/MySQLServiceQueryStatisticsRequestBody' example: limit: 100 offset: 100 order_by: count_star:desc,sum_timer_wait:asc responses: '200': description: Response content: application/json: schema: $ref: '#/components/schemas/MySQLServiceQueryStatisticsResponse' security: - tokenAuth: [] oauth2: - services:read /mysql/query/validate: post: summary: Validate SQL query syntax tags: - Service:_MySQL operationId: MySQLServiceQueryValidate x-badges: - name: Experimental position: after color: '#787885' x-experimental: true description:
This endpoint may be changed or removed at any time. Don't use it in production environments.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/MySQLServiceQueryValidateRequestBody'
example:
do_not_store: true
query: select email from users;
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/MySQLServiceQueryValidateResponse'
'400':
description: Invalid request parameters
content:
application/json:
schema:
type: object
properties:
message:
type: string
title: Human readable error message
errors:
type: array
title: List of error details. Typically there is only one element
items:
type: object
properties:
message:
type: string
title: Human readable error message
error_code:
type: string
enum:
- query_validation_failed
title: Machine processable error code. Clients must be prepared to handle new codes.
description: 'query_validation_failed: Query validation failed'
components:
schemas:
MySQLServiceMetadataValidateRequestBody:
type: object
description: MySQLServiceMetadataValidateRequestBody
properties:
db_version:
type: string
description: Database version
metadata:
type: string
description: Metadata to validate
required:
- db_version
- metadata
MySQLServiceMetadataValidateResponse:
type: object
description: MySQLServiceMetadataValidateResponse
properties:
status:
type: string
description: Status
required:
- status
MySQLAccountQueryOptimizeResponse:
type: object
description: MySQLAccountQueryOptimizeResponse
properties:
optimize:
type: object
description: Optimize
properties:
existing_recommended_indexes:
type: array
description: Existing Recommended Indexes
items:
type: object
properties:
index_definition:
type: string
description: Index definition
required:
- index_definition
index_recommendations:
type: array
description: Index Recommendations
items:
type: object
properties:
creation_cmd:
type: string
description: Creation command
table_name:
type: string
description: Table name
required:
- creation_cmd
- table_name
optimization_id:
type: string
description: Optimization ID
optimized_query:
type: string
description: Optimized query in base64 format
original_query:
type: string
description: Original query in base64 format
recommendations:
type: array
description: Recommendations
items:
type: object
properties:
bad_practice_sample:
type: string
description: Bad practice sample
best_practice_sample:
type: string
description: Best practice sample
description:
type: string
description: Description
fixable:
type: boolean
description: Fixable
line_number:
type: integer
description: Line number
priority:
type: integer
description: Priority
title:
type: string
description: Title
type:
type: integer
description: Type
required:
- bad_practice_sample
- best_practice_sample
- description
- fixable
- line_number
- priority
- title
- type
required:
- existing_recommended_indexes
- index_recommendations
- optimized_query
- original_query
- recommendations
required:
- optimize
MySQLServiceQueryValidateRequestBody:
type: object
description: MySQLServiceQueryValidateRequestBody
properties:
do_not_store:
type: boolean
description: Do not store details
default: false
query:
type: string
description: Query
required:
- query
MySQLServiceQueryStatisticsRequestBody:
type: object
description: MySQLServiceQueryStatisticsRequestBody
properties:
limit:
type: integer
minimum: 1
maximum: 5000
description: Limit for number of results
default: 100
offset:
type: integer
minimum: 0
description: Offset for retrieved results based on sort order
default: 0
order_by:
type: string
maxLength: 256
description: 'Sort order can be either asc or desc and multiple comma separated columns with their own order can be specified: :asc,:desc. Accepted sort columns are: avg_timer_wait, count_star, digest, digest_text, first_seen, last_seen, max_timer_wait, min_timer_wait, query_sample_seen, query_sample_text, query_sample_timer_wait, quantile_95, quantile_99, quantile_999, schema_name, sum_created_tmp_disk_tables, sum_created_tmp_tables, sum_errors, sum_lock_time, sum_no_good_index_used, sum_no_index_used, sum_rows_affected, sum_rows_examined, sum_rows_sent, sum_select_full_join, sum_select_full_range_join, sum_select_range, sum_select_range_check, sum_select_scan, sum_sort_merge_passes, sum_sort_range, sum_sort_rows, sum_sort_scan, sum_timer_wait, sum_warnings'
title: Order in which to sort retrieved results
default: count_star:desc
MySQLServiceDatabaseMetadataQueryResponse:
type: object
description: MySQLServiceDatabaseMetadataQueryResponse
properties:
metadata_query:
type: string
description: Database metadata retrieval query
required:
- metadata_query
MySQLServiceQueryStatisticsResponse:
type: object
description: MySQLServiceQueryStatisticsResponse
properties:
errors:
type: array
description: List of errors occurred during request processing
items:
type: object
properties:
message:
type: string
description: Printable error message
more_info:
type: string
description: URL to the documentation of the error
status:
type: integer
description: HTTP error status code
required:
- message
- status
message:
type: string
description: Printable result of the request
queries:
type: array
description: List of query statistics
items:
type: object
properties:
avg_timer_wait:
type: number
description: Query statistic
count_star:
type: number
description: Query statistic
digest:
type: string
description: Query statistic
digest_text:
type: string
description: Query statistic
first_seen:
type: string
description: Query statistic
last_seen:
type: string
description: Query statistic
max_timer_wait:
type: number
description: Query statistic
min_timer_wait:
type: number
description: Query statistic
quantile_95:
type: number
description: Query statistic
quantile_99:
type: number
description: Query statistic
quantile_999:
type: number
description: Query statistic
query_sample_seen:
type: string
description: Query statistic
query_sample_text:
type: string
description: Query statistic
query_sample_timer_wait:
type: string
description: Query statistic
schema_name:
type: string
description: Query statistic
sum_created_tmp_disk_tables:
type: number
description: Query statistic
sum_created_tmp_tables:
type: number
description: Query statistic
sum_errors:
type: number
description: Query statistic
sum_lock_time:
type: number
description: Query statistic
sum_no_good_index_used:
type: number
description: Query statistic
sum_no_index_used:
type: number
description: Query statistic
sum_rows_affected:
type: number
description: Query statistic
sum_rows_examined:
type: number
description: Query statistic
sum_rows_sent:
type: number
description: Query statistic
sum_select_full_join:
type: number
description: Query statistic
sum_select_full_range_join:
type: number
description: Query statistic
sum_select_range:
type: number
description: Query statistic
sum_select_range_check:
type: number
description: Query statistic
sum_select_scan:
type: number
description: Query statistic
sum_sort_merge_passes:
type: number
description: Query statistic
sum_sort_range:
type: number
description: Query statistic
sum_sort_rows:
type: number
description: Query statistic
sum_sort_scan:
type: number
description: Query statistic
sum_timer_wait:
type: number
description: Query statistic
sum_warnings:
type: number
description: Query statistic
required:
- queries
MySQLServiceQueryValidateResponse:
type: object
description: MySQLServiceQueryValidateResponse
properties:
status:
type: string
description: Status
required:
- status
MySQLAccountQueryOptimizeRequestBody:
type: object
description: MySQLAccountQueryOptimizeRequestBody
properties:
do_not_store:
type: boolean
description: Do not store details
default: false
flags:
type: array
description: Optimization flags
items:
type: string
mysql_version:
type: string
description: An enumeration.
title: MySQL version
enum:
- '5.0'
- '5.1'
- '5.5'
- '5.6'
- '5.7'
- '8.0'
- '8.1'
- '8.2'
- '8.3'
- '8.4'
query:
type: string
description: Query
schema_metadata:
type: string
description: Schema metadata
required:
- flags
- mysql_version
- query
parameters:
service_name:
in: path
name: service_name
description: Service name
schema:
type: string
required: true
project:
in: path
name: project
description: Project name
schema:
type: string
required: true
account_id:
in: path
name: account_id
description: Account ID
schema:
type: string
required: true
securitySchemes:
tokenAuth:
description: 'Header should be of the format `authorization: aivenv1