- API-Referenz
- Datenbank
- List MySQL databases belonging to a Project
List MySQL databases belonging to a Project
Request
- projectIdstringrequired
ID of the Project to list MySQLDatabases for.
Responses
OK
- Array[
- *object
- characterSettingsobjectrequired
- characterSetstringrequired
A valid MySQL character set. Refer to the MySQL manual for more information and available character sets.
You can also use the
GET /v2/mysql-charsetsendpoint to query available character sets for your MySQL database. - collationstringrequired
A valid MySQL collation. Refer to the MySQL manual for more information and available collations.
You can also use the
GET /v2/mysql-charsetsendpoint to query available character sets (and collations of these character sets) for your MySQL database.
- createdAtstring (date-time)required
- descriptionstringrequired
A description of the MySQLDatabase. This is for your own reference and has no effect on the database itself.
- externalHostnamestringrequired
The hostname that you can use to connect to this MySQLDatabase from external sources, like your local machine or services running outside the mittwald cloud platform.
Note that you still need a database user with
externalAccessenabled to connect via this hostname. - finalizersArray von string (≥ 1 Zeichen)
- Array[
- *string (≥ 1 Zeichen)
]
- hostnamestringrequired
The hostname that you can use to connect to this MySQLDatabase from within the hosting environment.
- idstring (uuid)required
- isReadybooleanrequired
- isSharedbooleanrequired
- mainUserobject
- accessLevelstring (einer von: full, readonly)required
The access level that this MySQLUser should have for the database. The
fullaccess level grants the user read/write privileges on the database. - createdAtstring (date-time)required
- databaseIdstring (uuid)required
- descriptionstring
- disabledbooleanrequired
- externalAccessbooleanrequired
Describes if users should be able to connection to this database from external sources. Defaults to
falsewhen not set.To find out how to connect to your database from external sources, refer to the
externalHostnamefield of theGET /v2/mysql-databases/{id}endpoint. - idstring (uuid)required
- mainUserbooleanrequired
Indicates whether this MySQL user is the main user of the database. The main user is created by default when a new MySQL database is provisioned. It can neither be deleted nor disabled, but its password can be updated.
- namestringrequired
The name of the MySQL user. This can be used as the username when connecting to the database.
- passwordUpdatedAtstring (date-time)required
- statusstring (einer von: pending, ready, error, terminating, disabled)required
- statusSetAtstring (date-time)required
- updatedAtstring (date-time)required
- namestringrequired
The name of the MySQLDatabase. This is also the name of the database that you can use when connecting to it. It is automatically generated and cannot be changed.
- projectIdstring (uuid)required
- statusstring (einer von: pending, ready, migrating, importing, error, terminating)required
- statusSetAtstring (date-time)required
- storageUsageInBytesinteger (int64)required
- storageUsageInBytesSetAtstring (date-time)required
- updatedAtstring (date-time)required
- versionstringrequired
The MySQL version that this database is running, in
<major>.<minor>format. Use theGET /v2/mysql-versionsendpoint to query available versions.
]
Content-Type: application/json
[
{
"characterSettings": {
"characterSet": "utf8mb4",
"collation": "utf8mb4_general_ci"
},
"createdAt": "1985-10-26T01:21:00.000Z",
"description": "string",
"externalHostname": "mysql.example-cluster.project.host",
"finalizers": [
"string"
],
"hostname": "mysql-XXXXXX.pg-YYYYYY.db.project.host",
"id": "f0f86186-0a5a-45b2-aa33-502777496347",
"isReady": true,
"isShared": true,
"mainUser": {
"accessLevel": "full",
"createdAt": "1985-10-26T01:21:00.000Z",
"databaseId": "f0f86186-0a5a-45b2-aa33-502777496347",
"description": "string",
"disabled": true,
"externalAccess": true,
"id": "f0f86186-0a5a-45b2-aa33-502777496347",
"mainUser": true,
"name": "dbu_XXXXXX",
"passwordUpdatedAt": "1985-10-26T01:21:00.000Z",
"status": "pending",
"statusSetAt": "1985-10-26T01:21:00.000Z",
"updatedAt": "1985-10-26T01:21:00.000Z"
},
"name": "string",
"projectId": "f0f86186-0a5a-45b2-aa33-502777496347",
"status": "pending",
"statusSetAt": "1985-10-26T01:21:00.000Z",
"storageUsageInBytes": 123,
"storageUsageInBytesSetAt": "1985-10-26T01:21:00.000Z",
"updatedAt": "1985-10-26T01:21:00.000Z",
"version": "8.4"
}
]
{
"items": {
"properties": {
"characterSettings": {
"properties": {
"characterSet": {
"description": "A valid MySQL character set. Refer to the [MySQL manual](https://dev.mysql.com/doc/refman/8.4/en/charset-mysql.html)\nfor more information and available character sets.\n\nYou can also use the [`GET /v2/mysql-charsets` endpoint](/docs/v2/reference/database/database-list-mysql-charsets/)\nto query available character sets for your MySQL database.\n",
"example": "utf8mb4",
"type": "string"
},
"collation": {
"description": "A valid MySQL collation. Refer to the [MySQL manual](https://dev.mysql.com/doc/refman/8.4/en/charset-mysql.html)\nfor more information and available collations.\n\nYou can also use the [`GET /v2/mysql-charsets` endpoint](/docs/v2/reference/database/database-list-mysql-charsets/)\nto query available character sets (and collations of these character sets) for your MySQL database.\n",
"example": "utf8mb4_general_ci",
"type": "string"
}
},
"required": [
"characterSet",
"collation"
],
"type": "object"
},
"createdAt": {
"format": "date-time",
"type": "string"
},
"description": {
"description": "A description of the MySQLDatabase. This is for your own reference and has no effect on the database itself.\n",
"type": "string"
},
"externalHostname": {
"description": "The hostname that you can use to connect to this MySQLDatabase from external sources, like your local machine or services running outside the mittwald cloud platform.\n\nNote that you still need a database user with `externalAccess` enabled to connect via this hostname.\n",
"example": "mysql.example-cluster.project.host",
"type": "string"
},
"finalizers": {
"items": {
"minLength": 1,
"type": "string"
},
"type": "array",
"uniqueItems": true
},
"hostname": {
"description": "The hostname that you can use to connect to this MySQLDatabase from _within_ the hosting environment.\n",
"example": "mysql-XXXXXX.pg-YYYYYY.db.project.host",
"type": "string"
},
"id": {
"format": "uuid",
"type": "string"
},
"isReady": {
"type": "boolean"
},
"isShared": {
"type": "boolean"
},
"mainUser": {
"properties": {
"accessLevel": {
"description": "The access level that this MySQLUser should have for the database. The `full` access level grants\nthe user read/write privileges on the database.\n",
"enum": [
"full",
"readonly"
],
"type": "string"
},
"createdAt": {
"format": "date-time",
"type": "string"
},
"databaseId": {
"format": "uuid",
"type": "string"
},
"description": {
"type": "string"
},
"disabled": {
"type": "boolean"
},
"externalAccess": {
"description": "Describes if users should be able to connection to this database from external sources.\nDefaults to `false` when not set.\n\nTo find out how to connect to your database from external sources, refer to the `externalHostname`\nfield of the `GET /v2/mysql-databases/{id}` endpoint.\n",
"type": "boolean"
},
"id": {
"format": "uuid",
"type": "string"
},
"mainUser": {
"description": "Indicates whether this MySQL user is the main user of the database. The main user is created by\ndefault when a new MySQL database is provisioned. It can neither be deleted nor disabled,\nbut its password can be updated.\n",
"type": "boolean"
},
"name": {
"description": "The name of the MySQL user. This can be used as the username when connecting to the database.\n",
"example": "dbu_XXXXXX",
"type": "string"
},
"passwordUpdatedAt": {
"format": "date-time",
"type": "string"
},
"status": {
"enum": [
"pending",
"ready",
"error",
"terminating",
"disabled"
],
"type": "string"
},
"statusSetAt": {
"format": "date-time",
"type": "string"
},
"updatedAt": {
"format": "date-time",
"type": "string"
}
},
"required": [
"id",
"createdAt",
"updatedAt",
"databaseId",
"name",
"passwordUpdatedAt",
"mainUser",
"disabled",
"accessLevel",
"externalAccess",
"status",
"statusSetAt"
],
"type": "object"
},
"name": {
"description": "The name of the MySQLDatabase. This is also the name of the database that you can use when connecting to it. It is automatically generated and cannot be changed.\n",
"type": "string"
},
"projectId": {
"format": "uuid",
"type": "string"
},
"status": {
"enum": [
"pending",
"ready",
"migrating",
"importing",
"error",
"terminating"
],
"type": "string"
},
"statusSetAt": {
"format": "date-time",
"type": "string"
},
"storageUsageInBytes": {
"format": "int64",
"type": "integer"
},
"storageUsageInBytesSetAt": {
"format": "date-time",
"type": "string"
},
"updatedAt": {
"format": "date-time",
"type": "string"
},
"version": {
"description": "The MySQL version that this database is running, in `<major>.<minor>` format. Use the `GET /v2/mysql-versions` endpoint to query available versions.\n",
"example": "8.4",
"type": "string"
}
},
"required": [
"id",
"createdAt",
"updatedAt",
"projectId",
"name",
"description",
"version",
"characterSettings",
"hostname",
"isShared",
"isReady",
"storageUsageInBytes",
"storageUsageInBytesSetAt",
"status",
"statusSetAt",
"externalHostname"
],
"type": "object"
},
"type": "array"
}
Validation Error caused by invalid input data in the request
- type"ValidationError"required
- messagestring
- validationErrorsArray von objectrequired
- Array[
- *object
- messagestringrequired
The standard error message
- pathstringrequired
The path to the part of the data that was validated. JavaScript property access notation (e.g., ".prop[1].subProp") is used.
- typestringrequired
ajv validation error type (e.g. "format", "required", "type") or own validation error types
- contextobject
The object with the additional information about the error that can be used to create custom error messages. Keys depend on the type that failed validation (e.g. "missingProperty" for type "required")
- *string
]
Content-Type: application/json
{
"type": "ValidationError",
"message": "Validation failed",
"validationErrors": [
{
"message": "should be string",
"path": ".address.street",
"type": "format",
"context": {
"format": "email"
}
}
]
}
{
"type": "object",
"required": [
"type",
"validationErrors"
],
"properties": {
"type": {
"type": "string",
"enum": [
"ValidationError"
]
},
"message": {
"type": "string",
"example": "Validation failed"
},
"validationErrors": {
"type": "array",
"items": {
"type": "object",
"required": [
"message",
"path",
"type"
],
"properties": {
"message": {
"type": "string",
"description": "The standard error message",
"example": "should be string"
},
"path": {
"type": "string",
"description": "The path to the part of the data that was validated. JavaScript property access notation (e.g., \".prop[1].subProp\") is used.\n",
"example": ".address.street"
},
"type": {
"type": "string",
"description": "ajv validation error type (e.g. \"format\", \"required\", \"type\") or own validation error types",
"example": "format"
},
"context": {
"type": "object",
"example": {
"format": "email"
},
"description": "The object with the additional information about the error that can be used to create custom error messages. Keys depend on the\ntype that failed validation (e.g. \"missingProperty\" for type \"required\")\n",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
}
An unexpected Error that occurred while handling the request
- messagestringrequired
- typestringrequired
Content-Type: application/json
{
"message": "Something went wrong",
"type": "InternalServerError"
}
{
"type": "object",
"required": [
"type",
"message"
],
"properties": {
"message": {
"type": "string",
"example": "Something went wrong"
},
"type": {
"type": "string",
"example": "InternalServerError"
}
}
}
Your request ran into a rate limit. You have to wait until rate limit expires
- messagestring
- typestring
Content-Type: application/json
{
"message": "too many requests",
"type": "RateLimitError"
}
{
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "too many requests"
},
"type": {
"type": "string",
"example": "RateLimitError"
}
}
}
An unexpected Error that occurred while handling the request
- messagestringrequired
- typestringrequired
Content-Type: application/json
{
"message": "Something went wrong",
"type": "InternalServerError"
}
{
"type": "object",
"required": [
"type",
"message"
],
"properties": {
"message": {
"type": "string",
"example": "Something went wrong"
},
"type": {
"type": "string",
"example": "InternalServerError"
}
}
}
Nutzungsbeispiele
$ curl \
--fail \
--location \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
https://api.mittwald.de/v2/projects/string/mysql-databases
import { MittwaldAPIV2Client } from "@mittwald/api-client";
import { assertStatus } from "@mittwald/api-client-commons";
const client = MittwaldAPIClient.newWithToken(process.env.MITTWALD_API_TOKEN);
const response = await client.database.listMysqlDatabases({
"projectId": "string"
});
assertStatus(response, 200);
use \Mittwald\ApiClient\Generated\V2\Clients\Database\ListMysqlDatabases\ListMysqlDatabasesRequest;
$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));
$request = (new ListMysqlDatabasesRequest(
projectId: "string"
));
$response = $client->database()->listMysqlDatabases($request);
var_dump($response->getBody();