Class: QgsServerOgcApi

class qgis.server.QgsServerOgcApi

Bases: qgis._server.QgsServerApi

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(:py:class:`.QgsServerOgcApiHandler`):
  """A handler, see :py:class:`.QgsServerOgcApiHandler` for an example"""
  ...

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

New in version 3.10.

QgsServerOgcApi(serverIface: QgsServerInterface, rootPath: str, name: str, description: str = ‘’, version: str = ‘’) QgsServerOgcApi constructor

Parameters:
  • serverIface – pointer to the server interface

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

  • name – API name

  • description – API description

  • version – API version

QgsServerOgcApi(QgsServerOgcApi)

Methods

contenTypeFromExtension

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.

description

rtype:

str

executeRequest

Executes a request by passing the given context to the API handlers.

mimeType

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

name

rtype:

str

registerHandler

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

relToString

Returns the string representation of rel attribute.

rootPath

rtype:

str

sanitizeUrl

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

version

rtype:

str

Attributes

GEOJSON

HTML

JSON

OPENAPI3

XML

alternate

collection

conformance

data

describedBy

item

items

license

next

prev

self

service_desc

service_doc

staticMetaObject

class ContentType

Bases: int

baseClass

alias of QgsServerOgcApi

GEOJSON = 0
HTML = 3
JSON = 2
OPENAPI3 = 1
class Rel

Bases: int

baseClass

alias of QgsServerOgcApi

XML = 4
alternate = 0
collection = 2
conformance = 11
contenTypeFromExtension(extension: object) QgsServerOgcApi.ContentType

Returns the Content-Type value corresponding to extension.

Parameters:

extension (object) –

Return type:

QgsServerOgcApi.ContentType

contentTypeToExtension(ct: QgsServerOgcApi.ContentType) str

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

Parameters:

ct (QgsServerOgcApi.ContentType) –

Return type:

str

contentTypeToStdString(ct: QgsServerOgcApi.ContentType) object

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

Parameters:

ct (QgsServerOgcApi.ContentType) –

Return type:

object

contentTypeToString(ct: QgsServerOgcApi.ContentType) str

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

Parameters:

ct (QgsServerOgcApi.ContentType) –

Return type:

str

data = 12
describedBy = 1
description(self) str
Return type:

str

executeRequest(self, context: QgsServerApiContext)

Executes a request by passing the given context to the API handlers.

Parameters:

context (QgsServerApiContext) –

item = 3
items = 10
license = 9
mimeType(contentType: QgsServerOgcApi.ContentType) object

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

Parameters:

contentType (QgsServerOgcApi.ContentType) –

Return type:

object

name(self) str
Return type:

str

next = 8
prev = 7
registerHandler(self, handler: QgsServerOgcApiHandler)

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

Parameters:

handler (QgsServerOgcApiHandler) –

relToString(rel: QgsServerOgcApi.Rel) object

Returns the string representation of rel attribute.

Parameters:

rel (QgsServerOgcApi.Rel) –

Return type:

object

rootPath(self) str
Return type:

str

sanitizeUrl(url: QUrl) QUrl

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
staticMetaObject = <PyQt5.QtCore.QMetaObject object>
version(self) str
Return type:

str