Skip to content
AquadactylAquadactyl
API referenceApplication API

Users

6 source-verified application API operations in Aquadactyl.

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

GET /api/application/users

Handle request to list all users on the panel. Returns a JSON-API representation of a collection of users including any defined relations passed in the request.

Access: Administrator account.

Source: Route · Controller · Request validation

Validation is inherited from ApplicationApiRequest.php.

Other controller inputs: per_page.

List query options: filters declared in 'email', 'uuid', 'username', 'external_id'; sorts 'id', 'uuid'. Use filter[name]=value and sort=-id only with supported fields.

Response

Success: 200. Response attributes: Application UserTransformer. 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.

$users = QueryBuilder::for(User::query())
    ->allowedFilters('email', 'uuid', 'username', 'external_id')
    ->allowedSorts('id', 'uuid')
    ->paginate($request->query('per_page') ?? 50);

return $this->fractal->collection($users)
    ->transformWith($this->getTransformer(UserTransformer::class))
    ->toArray();

Example request

curl --get "${PANEL_URL}/api/application/users" \
  --header "Authorization: Bearer ${APPLICATION_API_KEY}" \
  --header "Accept: application/json"

GET /api/application/users/{user:id}

Handle a request to view a single user. Includes any relations that were defined in the request.

Access: Administrator account.

Source: Route · Controller · Request validation

Validation is inherited from ApplicationApiRequest.php.

Path parameters: user:id. See identifiers.

Response

Success: 200. Response attributes: Application UserTransformer. 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->item($user)
    ->transformWith($this->getTransformer(UserTransformer::class))
    ->toArray();

Example request

curl --get "${PANEL_URL}/api/application/users/RESOURCE_ID" \
  --header "Authorization: Bearer ${APPLICATION_API_KEY}" \
  --header "Accept: application/json"

GET /api/application/users/external/{external_id}

Retrieve a specific user from the database using their external ID.

Access: Administrator account; users ACL READ.

Source: Route · Controller · Request validation

Validation is inherited from ApplicationApiRequest.php.

Path parameters: external_id. See identifiers.

Response

Success: 200. Response attributes: Application UserTransformer. 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.

$user = User::query()->where('external_id', $external_id)->firstOrFail();

return $this->fractal->item($user)
    ->transformWith($this->getTransformer(UserTransformer::class))
    ->toArray();

Example request

curl --get "${PANEL_URL}/api/application/users/external/RESOURCE_ID" \
  --header "Authorization: Bearer ${APPLICATION_API_KEY}" \
  --header "Accept: application/json"

POST /api/application/users

Store a new user on the system. Returns the created user and an HTTP/201 header on successful creation.

Access: Administrator account; users ACL WRITE.

Source: Route · Controller · Request validation

Model constraints: User.php (including runtime rules and uniqueness checks for updates).

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
external_id'sometimes|nullable|string|max:191|unique:users,external_id'
email'required|email:strict|between:1,191|unique:users,email'
username'required|between:1,191|unique:users,username'
password'sometimes|nullable|string'
language'string'
root_admin'boolean'
first_name'required|string|between:1,191'
last_name'required|string|between:1,191'

Response

Success: 201. Response attributes: Application UserTransformer. 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.

$user = $this->creationService->handle($request->validated());

return $this->fractal->item($user)
    ->transformWith($this->getTransformer(UserTransformer::class))
    ->addMeta([
        'resource' => route('api.application.users.view', [
            'user' => $user->id,
        ]),
    ])
    ->respond(201);

PATCH /api/application/users/{user:id}

Update an existing user on the system and return the response. Returns the updated user model response on success. Supports handling of token revocation errors when switching a user from an admin to a normal user. Revocation errors are returned under the 'revocation_errors' key in the response meta. If there are no errors this is an empty array.

Access: Administrator account; users ACL WRITE.

Source: Route · Controller · Request validation

Model constraints: User.php (including runtime rules and uniqueness checks for updates).

Path parameters: user:id. 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
external_id'sometimes|nullable|string|max:191|unique:users,external_id'
email'required|email:strict|between:1,191|unique:users,email'
username'required|between:1,191|unique:users,username'
password'sometimes|nullable|string'
language'string'
root_admin'boolean'
first_name'required|string|between:1,191'
last_name'required|string|between:1,191'

Response

Success: 200. Response attributes: Application UserTransformer. 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.

$this->updateService->setUserLevel(User::USER_LEVEL_ADMIN);
$user = $this->updateService->handle($user, $request->validated());

$response = $this->fractal->item($user)
    ->transformWith($this->getTransformer(UserTransformer::class));

return $response->toArray();

DELETE /api/application/users/{user:id}

Handle a request to delete a user from the Panel. Returns a HTTP/204 response on successful deletion.

Access: Administrator account; users ACL WRITE.

Source: Route · Controller · Request validation

Validation is inherited from ApplicationApiRequest.php.

Path parameters: user:id. 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->deletionService->handle($user);

return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT);