Skip to content
AquadactylAquadactyl
API referenceClient API

Startup variables

2 source-verified client API operations in Aquadactyl.

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

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

Returns the startup information for the server including all the variables.

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

Source: Route · Controller · Request validation

Validation is inherited from ApplicationApiRequest.php.

Path parameters: server. See identifiers.

Response

Success: 200. Response attributes: Client EggVariableTransformer. 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.

$startup = $this->startupCommandService->handle($server);

return $this->fractal->collection(
    $server->variables()->where('user_viewable', true)->get()
)
    ->transformWith($this->getTransformer(EggVariableTransformer::class))
    ->addMeta([
        'startup_command' => $startup,
        'docker_images' => $server->egg->docker_images,
        'raw_startup_command' => $server->startup,
    ])
    ->toArray();

Example request

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

PUT /api/client/servers/{server}/startup/variable

Updates a single variable for a server.

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

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
key'required|string'
value'present'

Response

Success: 200. Response attributes: Client EggVariableTransformer. 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.

$variable = $server->variables()->where('env_variable', $request->input('key'))->first();

if (is_null($variable) || !$variable->user_viewable) {
    throw new BadRequestHttpException('The environment variable you are trying to edit does not exist.');
} elseif (!$variable->user_editable) {
    throw new BadRequestHttpException('The environment variable you are trying to edit is read-only.');
}

$original = $variable->server_value;

$this->validate($request, ['value' => $variable->rules]);

$this->repository->updateOrCreate([
    'server_id' => $server->id,
    'variable_id' => $variable->id,
], [
    'variable_value' => $request->input('value') ?? '',
]);

$variable = $variable->refresh();
$variable->server_value = $request->input('value');

$startup = $this->startupCommandService->handle($server);

if ($original !== $request->input('value')) {
    Activity::event('server:startup.edit')
        ->subject($variable)
        ->property([
            'variable' => $variable->env_variable,
            'old' => $original,
            'new' => $request->input('value') ?? '',
        ])
        ->log();
}

return $this->fractal->item($variable)
    ->transformWith($this->getTransformer(EggVariableTransformer::class))
    ->addMeta([
        'startup_command' => $startup,
        'raw_startup_command' => $server->startup,
    ])
    ->toArray();