Class: QgsServiceRegistry

class qgis.server.QgsServiceRegistry

Bases: sip.wrapper

Constructor

QgsServiceRegistry(QgsServiceRegistry)

QgsServiceRegistry Class defining the registry manager for QGIS server services

This class provides methods for registering and retrieving services.

IMPORTANT: The registry hold ownership of registered services and will call ‘delete’ on cleanup

Methods

cleanUp

Clean up registered service and unregister modules

getApi

Retrieves an API from its name

getService

Retrieve a service from its name

init

Initialize registry, load modules and auto register services

registerApi

Registers the QgsServerApi api

registerService

Register a service by its name and version

unregisterApi

Unregisters API from its name and version

unregisterService

Unregister service from its name and version

cleanUp(self)

Clean up registered service and unregister modules

getApi(self, name: str, version: str = '') → QgsServerApi

Retrieves an API from its name

If the version is not provided the higher version of the service is returned

Parameters
  • name (str) – the name of the API

  • version (str = '') – the version string (optional)

Return type

QgsServerApi

Returns

QgsServerApi

New in version 3.10.

getService(self, name: str, version: str = '') → QgsService

Retrieve a service from its name

Parameters
  • name (str) – the name of the service

  • version (str = '') – the version string (optional)

Return type

QgsService

Returns

QgsService

If the version is not provided the higher version of the service is returned

init(self, nativeModulepath: str, serverIface: QgsServerInterface = None)

Initialize registry, load modules and auto register services

Parameters
  • serverIface (QgsServerInterface = None) – the server interface

  • nativeModulepath (str) – the native module path

registerApi(self, api: QgsServerApi) → bool

Registers the QgsServerApi api

The registry takes ownership of services and will call ‘delete’ on cleanup

New in version 3.10.

Parameters

api (QgsServerApi) –

Return type

bool

registerService(self, service: QgsService)

Register a service by its name and version

This method is intended to be called by modules for registering services. A module may register multiple services.

The registry takes ownership of services and will call ‘delete’ on cleanup

Parameters

service (QgsService) – a QgsService to be registered

unregisterApi(self, name: str, version: str = '') → int

Unregisters API from its name and version

Parameters
  • name (str) – the name of the service

  • version (str = '') – (optional) the specific version to unload

Return type

int

Returns

the number of APIs unregistered

If the version is not specified then all versions from the specified API are unloaded

New in version 3.10.

unregisterService(self, name: str, version: str = '') → int

Unregister service from its name and version

Parameters
  • name (str) – the name of the service

  • version (str = '') – (optional) the specific version to unload

Return type

int

Returns

the number of services unregistered

If the version is not specified then all versions from the specified service are unloaded