Class: QgsServerQueryStringParameter

class qgis.server.QgsServerQueryStringParameter(name: str, required: bool = False, type: QgsServerQueryStringParameter.Type = QgsServerQueryStringParameter.Type.String, description: str = '', defaultValue: Any = None)

Bases: sip.wrapper

Constructs a QgsServerQueryStringParameter object.

Parameters
  • name – parameter name

  • required

  • type – the parameter type

  • description – parameter description

  • defaultValue – default value, it is ignored if the parameter is required

QgsServerQueryStringParameter(QgsServerQueryStringParameter)

The QgsServerQueryStringParameter class holds the information regarding a query string input parameter and its validation.

The class is extendable through custom validators (C++ only) and/or by subclassing and overriding the value() method.

New in version 3.10: Enums

Type

The Type enum represents the parameter type

Methods

description

Returns parameter description

name

Returns the name of the parameter

setDescription

Sets validator description

typeName

Returns the name of the type

value

Extracts the value from the request context by validating the parameter value and converting it to its proper Type.

Signals

Attributes

staticMetaObject

class Type

Bases: enum.IntEnum

The Type enum represents the parameter type

  • String:

  • Integer:

  • Double:

  • Boolean:

  • List:

Boolean = 1
Double = 6
Integer = 4
List = 11
String = 10
baseClass

alias of QgsServerQueryStringParameter

description(self) → str

Returns parameter description

name(self) → str

Returns the name of the parameter

setDescription(self, description: str)

Sets validator description

staticMetaObject = <PyQt5.QtCore.QMetaObject object>
typeName(type: QgsServerQueryStringParameter.Type) → str

Returns the name of the type

value(self, context: QgsServerApiContext) → Any

Extracts the value from the request context by validating the parameter value and converting it to its proper Type. If the value is not set and a default was not provided an invalid QVariant is returned.

Validation steps: - required - can convert to proper Type - custom validator (if set - not available in Python bindings)

See also

setCustomValidator()

Returns

the parameter value or an invalid QVariant if not found (and not required)

Raises

QgsServerApiBadRequestError – if validation fails