Home

restwhich

Restwhich is a coined term describing a design pattern for RESTful APIs that lets clients specify, within a single request, which resources and fields should be included in the response. The concept combines ideas from sparse fieldsets, resource graphs, and query-like selectors to reduce over-fetch and tailor responses without adopting a full GraphQL interface.

Origin and scope: The term restwhich appears in API design discussions as a shorthand for choosing which

Usage and syntax: A request includes a which parameter that enumerates resources and fields. Example: GET /customers/42?which=profile(name,email),orders(id,total).

Implementation notes: Server-side logic builds a projection from the which clause, mapping to database queries or

Reception and comparison: Critics argue that restwhich can increase server-side complexity and reduce uniformity across APIs,

See also: REST, GraphQL, JSON:API, OData, sparse fieldsets.

data
to
fetch
inside
REST.
It
is
not
an
established
standard,
but
a
conceptual
pattern
used
in
examples
and
proposals
to
illustrate
data
shaping
within
RESTful
endpoints.
The
server
interprets
the
projection
to
return
only
those
fields
and
related
sub-resources;
nested
notation
may
be
supported
to
shape
related
data.
Some
designs
use
a
hierarchical
or
comma-separated
syntax,
while
others
describe
field
masks
or
subresource
selectors.
ORM
selections.
Caching,
versioning,
and
security
considerations
apply,
and
interoperability
with
existing
REST
tooling
is
important.
Some
implementations
overlap
with
sparse
fieldsets
or
with
OData-style
query
options.
while
proponents
see
it
as
a
middle
ground
between
rigid
REST
and
GraphQL.
It
offers
a
data-shaping
mechanism
within
REST
without
introducing
a
new
protocol.