Skip to content
AquadactylAquadactyl
API referenceClient API

Server databases

4 source-verified client API operations in Aquadactyl.

Generated from Aquadactyl 2bfd6ae2a30c. Read authentication and conventions first.

GET /api/client/servers/{server}/databases

Return all the databases that belong to the given server.

Access: Client API key or authenticated panel session; database.read.

Source: Route · Controller · Request validation

Validation is inherited from ApplicationApiRequest.php.

Path parameters: server. See identifiers.

Response

Success: 200. Response attributes: Client DatabaseTransformer. Collections use the list envelope described in conventions.

Response construction and endpoint behavior

This source excerpt includes conditional responses, metadata, pagination, and service calls for this operation.

return $this->fractal->collection($server->databases)
    ->transformWith($this->getTransformer(DatabaseTransformer::class))
    ->toArray();

Example request

curl --get "${PANEL_URL}/api/client/servers/SERVER_UUID/databases" \
  --header "Authorization: Bearer ${CLIENT_API_KEY}" \
  --header "Accept: application/json"

POST /api/client/servers/{server}/databases

Create a new database for the given server and return it.

Access: Client API key or authenticated panel session; database.create.

Source: Route · Controller · Request validation

Path parameters: server. See identifiers.

Input fields

Rules use Laravel validation syntax. Dotted keys describe nested objects; * describes each array member. Model-derived rules are shown as their source expressions; model methods can add runtime constraints.

FieldValidation
database[ 'bail', 'required', 'alpha_dash', 'min:3', 'max:48', function (string $attribute, mixed $value, \Closure $fail) use ($server) { if (Database::query()->where('server_id', $server->id) ->where('database', DatabaseManagementService::generateUniqueDatabaseName($value, $server->id))->exists()) { $fail($this->messages()['database.unique']); } }, ]
remote'required|string|regex:/^[\w\-\/.%:]+$/'

Response

Success: 200. Response attributes: Client DatabaseTransformer. Collections use the list envelope described in conventions.

Response construction and endpoint behavior

This source excerpt includes conditional responses, metadata, pagination, and service calls for this operation.

$database = Activity::event('server:database.create')->transaction(function ($log) use ($request, $server) {
    if ($server->databases()->lockForUpdate()->count() >= $server->database_limit) {
        throw new DisplayException('Cannot create additional databases on this server: limit has been reached.');
    }

    $database = $this->deployDatabaseService->handle($server, $request->validated());

    $log->subject($database)->property('name', $database->database);

    return $database;
});

return $this->fractal->item($database)
    ->parseIncludes(['password'])
    ->transformWith($this->getTransformer(DatabaseTransformer::class))
    ->toArray();

POST /api/client/servers/{server}/databases/{database}/rotate-password

Rotates the password for the given server model and returns a fresh instance to the caller.

Access: Client API key or authenticated panel session; database.update.

Source: Route · Controller · Request validation

Validation is inherited from ApplicationApiRequest.php.

Path parameters: server, database. See identifiers.

Response

Success: 200. Response attributes: Client DatabaseTransformer. Collections use the list envelope described in conventions.

Response construction and endpoint behavior

This source excerpt includes conditional responses, metadata, pagination, and service calls for this operation.

Activity::event('server:database.rotate-password')
    ->subject($database)
    ->property('name', $database->database)
    ->transaction(fn () => $this->passwordService->handle($database));

return $this->fractal->item($database->refresh())
    ->parseIncludes(['password'])
    ->transformWith($this->getTransformer(DatabaseTransformer::class))
    ->toArray();

DELETE /api/client/servers/{server}/databases/{database}

Removes a database from the server.

Access: Client API key or authenticated panel session; database.delete.

Source: Route · Controller · Request validation

Validation is inherited from ApplicationApiRequest.php.

Path parameters: server, database. See identifiers.

Response

Success: 204 (empty body).

Response construction and endpoint behavior

This source excerpt includes conditional responses, metadata, pagination, and service calls for this operation.

$this->managementService->delete($database);

Activity::event('server:database.delete')
    ->subject($database)
    ->property('name', $database->database)
    ->log();

return new Response('', Response::HTTP_NO_CONTENT);