gRPC
StateSet exposes 17 gRPC services alongside the REST API, covering the same commerce domains. Reach for gRPC when you’re calling service-to-service and want a typed contract and lower per-call overhead than JSON over HTTP.Connecting
The gRPC server listens on its own port — by default the HTTP port plus one, overridable withgrpc_port.
Every request is assigned an
x-request-id if it doesn’t carry one, and that ID is propagated to
the response — the same correlation identifier the REST API uses. Log it.
The shared vocabulary
Four messages instateset.common are used across every service. Get these right once.
PaginationRequest.page is 1-based. Page 0 is not the first page.
Services
Note the package name for returns:
stateset.return_order, not stateset.return — return is a
reserved word in several target languages, so the package is qualified. Generated client namespaces
follow suit.A service in full
ReturnService is representative — a create, a get, a status transition, and a filtered list:
List request are AND-ed, and an empty string means “don’t filter on
this” rather than “match empty”.
Calling a service
Errors
Failures come back as gRPC statuses rather than the REST error envelope. The mapping to expect:Related
- Overview — the REST surface and its conventions
- Sync Server gRPC flow — a production dispatch path over gRPC
- Protocol Buffers — the IDL itself