Skip to content

params

URL query parameters.

SearchQueryParams

URL query parameters for GET /search

This is an extension of the EntryListingQueryParams class in optimade, which defines the standard entry listing endpoint query parameters.

The extra query parameters are as follows.

Attributes:

Name Type Description
database_ids set[str]

List of possible database IDs that are already known by the gateway. To be known they need to be registered with the gateway (currently not possible).

optimade_urls list[AnyUrl]

A list of OPTIMADE base URLs. If a versioned base URL is supplied it will be used as is, as long as it represents a supported version. If an un-versioned base URL, standard version negotiation will be conducted to get the versioned base URL, which will be used as long as it represents a supported version.

Example: http://example.org/optimade/v1/search?optimade_urls="https://example.org/optimade_db/v1","https://optimade.herokuapp.com"

endpoint str

The entry endpoint queried. According to the OPTIMADE specification, this is the same as the resource's type.

Example: structures

timeout int

Timeout time (in seconds) to wait for a query to finish before redirecting (after starting the query). Note, if the query has not finished after the timeout time, a redirection will still be performed, but to a zero-results page, which can be refreshed to get the finished query (once it has finished).

as_optimade bool

Return the response as a standard OPTIMADE entry listing endpoint response. Otherwise, the response will be based on the QueriesResponseSingle model.

Source code in optimade_gateway/queries/params.py
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
class SearchQueryParams:
    """URL query parameters for `GET /search`

    This is an extension of the
    [`EntryListingQueryParams`](https://www.optimade.org/optimade-python-tools/api_reference/server/query_params/#optimade.server.query_params.EntryListingQueryParams)
    class in `optimade`, which defines the standard entry listing endpoint query
    parameters.

    The extra query parameters are as follows.

    Attributes:
        database_ids (set[str]): List of possible database IDs that are already known by
            the gateway. To be known they need to be registered with the gateway
            (currently not possible).

        optimade_urls (list[AnyUrl]): A list of OPTIMADE base URLs. If a versioned base
            URL is supplied it will be used as is, as long as it represents a supported
            version. If an un-versioned base URL, standard version negotiation will be
            conducted to get the versioned base URL, which will be used as long as it
            represents a supported version.

            **Example**: `http://example.org/optimade/v1/search?optimade_urls="https://example.org/optimade_db/v1","https://optimade.herokuapp.com"`

        endpoint (str): The entry endpoint queried. According to the OPTIMADE
            specification, this is the same as the resource's type.

            **Example**: `structures`

        timeout (int): Timeout time (in seconds) to wait for a query to finish before
            redirecting (*after* starting the query). Note, if the query has not
            finished after the timeout time, a redirection will still be performed, but
            to a zero-results page, which can be refreshed to get the finished query
            (once it has finished).

        as_optimade (bool): Return the response as a standard OPTIMADE entry listing
            endpoint response. Otherwise, the response will be based on the
            [`QueriesResponseSingle`][optimade_gateway.models.responses.QueriesResponseSingle]
            model.

    """

    def __init__(
        self,
        *,
        database_ids: Annotated[
            set[str],
            Query(
                description=(
                    "Unique list of possible database IDs that are already known by "
                    "the gateway. To be known they need to be registered with the "
                    "gateway (currently not possible)."
                ),
            ),
        ] = set(),
        optimade_urls: Annotated[
            list[AnyUrl],
            Query(
                description=(
                    "A unique list of OPTIMADE base URLs. If a versioned base URL is "
                    "supplied it will be used as is, as long as it represents a "
                    "supported version. If an un-versioned base URL, standard version "
                    "negotiation will be conducted to get the versioned base URL, "
                    "which will be used as long as it represents a supported version."
                ),
            ),
        ] = [],
        endpoint: Annotated[
            str,
            Query(
                description=(
                    "The entry endpoint queried. According to the OPTIMADE "
                    "specification, this is the same as the resource's type."
                ),
            ),
        ] = "structures",
        timeout: Annotated[
            int,
            Query(
                description=(
                    "Timeout time (in seconds) to wait for a query to finish before "
                    "redirecting (*after* starting the query). Note, if the query has "
                    "not finished after the timeout time, a redirection will still be "
                    "performed, but to a zero-results page, which can be refreshed to "
                    "get the finished query (once it has finished)."
                ),
            ),
        ] = 15,
        as_optimade: Annotated[
            bool,
            Query(
                description=(
                    "Return the response as a standard OPTIMADE entry listing endpoint "
                    "response. Otherwise, the response will be based on the "
                    "[`QueriesResponseSingle`][optimade_gateway.models.responses.QueriesResponseSingle]"
                    " model."
                ),
            ),
        ] = False,
    ) -> None:
        self.database_ids = database_ids
        self.optimade_urls = optimade_urls
        self.endpoint = endpoint
        self.timeout = timeout
        self.as_optimade = as_optimade