Headless Server Developer Manual / Version 2301
Table Of Contents
Every persisted query may be accessed via REST. To enable access via REST, it is necessary, to add a
mapping of the persisted query to the intended endpoint. By default, the mapping is defined in the file
resources/graphql/rest-mapping/simple-mapping.properties
.
The name of the mapping file is configurable with the property caas.rest.query-mapping-pattern
.
The pattern must be suitable for a Spring PathMatchingResourcePatternResolver
which is used to load these resources.
# Spring PathMatchingResourcePattern to file or files # Defaults to 'graphql/rest-mapping/*.properties' # Example: caas.rest.query-mapping-pattern = graphql/rest-mapping/my-mappings.properties
Any persisted query which should be made accessible via REST must be mapped with the filename of the file where the query is defined, without the extension (.graphql), followed by an equal sign and the intended mapping URI fragment.
article = /article/{id} page = /page/{id} picture = /picture/{id} search = /search/ site = /site/{siteId}
The mapping file allows commenting lines via a #
in the beginning of a line.
Empty lines are also ignored, so using them for grouping is no problem.
The mapped URI fragment is always relative to the endpoint /caas/v1
.
In addition to a plain URI fragment, it is allowed, adding REST path parameters to the mapped URI fragment
using the URI template pattern: {myPathVariable}
. The path parameters are automatically
dispatched to the persisted query as GraphQL variables, as well as any query parameters.