Class: QgsServerOgcApi

QGIS Server OGC API endpoint. QgsServerOgcApi provides the foundation for the new generation of REST-API based OGC services (e.g. WFS3).

This class can be used directly and configured by registering handlers as instances of QgsServerOgcApiHandler.

class Handler1(QgsServerOgcApiHandler):
  """A handler, see QgsServerOgcApiHandler for an example"""
  ...

h = Handler1()
api = QgsServerOgcApi(serverInterface(), "/api1", "apione", "A firs API", "1.0")
api.registerHandler(h)
server.serverInterface().serviceRegistry().registerApi(api)

Added in version 3.10.

List of all members, including inherited members

Class Hierarchy

Inheritance diagram of qgis.server.QgsServerOgcApi

Base classes

QgsServerApi

Server generic API endpoint abstract base class.

Enums

ContentType

Rel

Methods

registerHandler

Registers an OGC API handler, ownership of the handler is transferred to the API

Static Methods

contenTypeFromExtension

Returns the Content-Type value corresponding to extension.

contentTypeFromExtension

Returns the Content-Type value corresponding to extension.

contentTypeToExtension

Returns the file extension for a ct (Content-Type).

contentTypeToStdString

Returns the string representation of a ct (Content-Type) attribute.

contentTypeToString

Returns the string representation of a ct (Content-Type) attribute.

mimeType

Returns the mime-type for the contentType or an empty string if not found

relToString

Returns the string representation of rel attribute.

sanitizeUrl

Returns a sanitized url with extra slashes removed and the path URL component that always starts with a slash.

class qgis.server.QgsServerOgcApi[source]

Bases: QgsServerApi

__init__(serverIface: QgsServerInterface | None, rootPath: str | None, name: str | None, description: str | None = '', version: str | None = '')

QgsServerOgcApi constructor

Parameters:
  • serverIface (Optional[QgsServerInterface]) – pointer to the server interface

  • rootPath (Optional[str]) – root path for this API (usually starts with a “/”, e.g. “/wfs3”)

  • name (Optional[str]) – API name

  • description (Optional[str] = '') – API description

  • version (Optional[str] = '') – API version

__init__(a0: QgsServerOgcApi)
Parameters:

a0 (QgsServerOgcApi)

class ContentType(*values)

Bases: IntEnum

GEOJSON = 0
HTML = 3
JSON = 2
OPENAPI3 = 1
XML = 4
GEOJSON = 0
HTML = 3
JSON = 2
OPENAPI3 = 1
class Rel(*values)

Bases: IntEnum

alternate = 0
collection = 2
conformance = 11
data = 12
describedBy = 1
item = 3
items = 10
license = 9
next = 8
prev = 7
self = 4
service_desc = 5
service_doc = 6
XML = 4
alternate = 0
collection = 2
conformance = 11
static contenTypeFromExtension(extension: Any) QgsServerOgcApi.ContentType[source]

Returns the Content-Type value corresponding to extension.

Deprecated since version 3.40: Use contentTypeFromExtension().

Parameters:

extension (Any)

Return type:

QgsServerOgcApi.ContentType

static contentTypeFromExtension(extension: Any) QgsServerOgcApi.ContentType[source]

Returns the Content-Type value corresponding to extension.

Added in version 3.38.

Parameters:

extension (Any)

Return type:

QgsServerOgcApi.ContentType

static contentTypeToExtension(ct: QgsServerOgcApi.ContentType) str[source]

Returns the file extension for a ct (Content-Type).

Parameters:

ct (QgsServerOgcApi.ContentType)

Return type:

str

static contentTypeToStdString(ct: QgsServerOgcApi.ContentType) Any[source]

Returns the string representation of a ct (Content-Type) attribute.

Parameters:

ct (QgsServerOgcApi.ContentType)

Return type:

Any

static contentTypeToString(ct: QgsServerOgcApi.ContentType) str[source]

Returns the string representation of a ct (Content-Type) attribute.

Parameters:

ct (QgsServerOgcApi.ContentType)

Return type:

str

data = 12
describedBy = 1
item = 3
items = 10
license = 9
static mimeType(contentType: QgsServerOgcApi.ContentType) Any[source]

Returns the mime-type for the contentType or an empty string if not found

Parameters:

contentType (QgsServerOgcApi.ContentType)

Return type:

Any

next = 8
prev = 7
registerHandler(self, handler: QgsServerOgcApiHandler | None)[source]

Registers an OGC API handler, ownership of the handler is transferred to the API

Parameters:

handler (Optional[QgsServerOgcApiHandler])

static relToString(rel: QgsServerOgcApi.Rel) Any[source]

Returns the string representation of rel attribute.

Parameters:

rel (QgsServerOgcApi.Rel)

Return type:

Any

static sanitizeUrl(url: QUrl) QUrl[source]

Returns a sanitized url with extra slashes removed and the path URL component that always starts with a slash.

Parameters:

url (QUrl)

Return type:

QUrl

self = 4
service_desc = 5
service_doc = 6