REST, GraphQL and gRPC
REST, GraphQL and gRPC: what each API style exposes, and how to choose one for an integration.
Most of this subject designs REST APIs, and most public APIs are REST. Two other styles are common enough that a designer meets them in the first architecture review: GraphQL, where the client writes a query naming the fields it wants, and gRPC, where services call each other's functions with generated, typed code. Each exists because REST is awkward for some job, and each is awkward for jobs REST does well.
The topic opens on what each style exposes, then gives GraphQL and gRPC a card each. One screen, an order with its items and products, runs through all three to show over-fetching and under-fetching. A card on Protocol Buffers shows how gRPC messages evolve, and a comparison sets the three side by side. A gotcha shows a GraphQL query with no limit on its cost, and an exercise chooses a style for four integrations.
It builds on resources, methods and status codes from the earlier topics in this subject, and on HTTP caching from the topic on caching.
By the end you can describe what each style exposes, choose a style for an integration, predict over-fetching and under-fetching, change a protobuf message safely, and spot a GraphQL query that needs a limit.
Contents
9 cardsnot started