aaieduhr/aosi-module-rest-server

AOSI REST Server Module

Maintainers

Package info

gitlab.opencode.hr/srce/aai-eduhr/aosi/aosi-module-rest-server

Type:aosi-module

pkg:composer/aaieduhr/aosi-module-rest-server

Transparency log

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

dev-main / 5.x-dev 2026-07-03 12:16 UTC

This package is auto-updated.

Last update: 2026-07-03 12:17:01 UTC


README

Provides pluggable JSON endpoints for AOSI modules.

Installation

composer require aaieduhr/aosi-module-rest-server

Enable aaieduhr/aosi-module-rest-server in the AOSI modules.enabled configuration. AOSI core registers methods returned by each enabled module's getRestServerMethods() manifest method.

Calling a method

Every method is exposed through POST /AOSI.rest/{method} and requires an application/json object body:

POST /AOSI.rest/anonSearch
Content-Type: application/json

{
  "base": "dc=example,dc=org",
  "filter": "(uid=test)",
  "attributes": ["uid", "cn"]
}

Success:

{"data":{"uid=test,dc=example,dc=org":{"uid":["test"]}}}

Errors use RFC 9457-style application/problem+json responses and meaningful HTTP status codes.

Providing methods

Return AaiEduHr\Aosi\RestServer\MethodDescriptor instances from an AOSI module manifest's getRestServerMethods() method. Handlers may be container services such as [ExampleHandler::class, 'example']; request parameters are validated from their SchemaDescriptor definitions before invocation.

For small modules, returning descriptors directly from the manifest or a required config file is usually enough. For larger method sets, prefer an autoloaded provider class and keep the config file as a thin delegation, for example:

use Vendor\ExampleModule\Config\ExampleRestMethods;

return ExampleRestMethods::all();

This module's config/rest_methods.php follows that pattern. Avoid defining shared closures inside config files as the reference style. Generic descriptor helpers are available through AaiEduHr\Aosi\RestServer\DescriptorFactory; module-specific helpers, such as default handler mapping or common parameter groups, should remain in the module provider class.

The generated API descriptions are available at:

  • /rest-server-documentation
  • /rest-server-openapi.json

Licence

This work is published under the European Union Public License v1.2.