33.10 Who reads, and the limits
Who reads. Every query runs in a query context (§29), and an endpoint, its facet page included, shows only what that context can read.
- An endpoint made in the admin UI reads as an anonymous visitor (
QueryContext.Anonymous): the published nodes that are not hidden and that everyone may read. - A code-first endpoint reads in the context its
QueryContextFactoryreturns, such as a signed-in user read from the request, and as an anonymous visitor without one.
Keeping it closed. The switches that matter:
apiKeysturns away every request without a valid key, the facet page's data included.- With
enableIntrospectionoff, the schema is not served (__schema,__type,?sdland the explorer). Queries themselves are not affected. - With
enableGetRequestsoff, a query cannot be put in a link. - Leave
allowMutationsoff unless the endpoint has a key, and mark types that clients must not change asreadOnly.
The limits keep one request from costing too much:
maxQueryDepthcaps how deeply a selection nests;maxIncludeDepthcaps how many relations deep it goes;maxPageSizecaps the page size.
A request over a depth limit is refused as a whole, with an error and no data. A page size over the
maximum is cut down to it. A "many" relation field without top returns all its related nodes, so
where one node has thousands of related nodes, query from the other side or use a view.