·

gRPC Migration from REST — A Field Guide

gRPC Migration from REST — A Field Guide — a complete, field-tested reference by John Kihiu.

John Kihiu12 min read

gRPC Migration from REST — A Field Guide is the work that makes the systems talk. The API is the contract between the producer and the consumer; the contract is what determines whether the integration succeeds or fails. This guide is the field-tested pattern for gRPC in a production context.

REST patterns

REST is still the default. The patterns that work:

The OpenAPI drift

The OpenAPI spec drifts from the implementation within a week of every release. The only fix is generation, not maintenance. Generate the spec from the routes, the validation rules, and the response schemas.

For the broader REST patterns, see the REST API definitive guide.

GraphQL patterns

GraphQL is the right tool when the client has many views of the same data and the network is the bottleneck. The patterns:

GRAPHQL · SCHEMA
type Query {
  customer(id: ID!): Customer
  customers(filter: CustomerFilter): [Customer!]!
}

type Mutation {
  createCustomer(input: CustomerInput!): Customer!
  updateCustomer(id: ID!, input: CustomerInput!): Customer!
}

type Subscription {
  orderStatus(orderId: ID!): OrderStatus!
}

type Customer {
  id: ID!
  name: String!
  email: String!
  orders(filter: OrderFilter): [Order!]!
}

gRPC and protocol buffers

gRPC is the right tool for service-to-service communication. The patterns:

PROTO · SERVICE DEFINITION
syntax = "proto3";

package ar.v1;

service ARService {
  rpc ListInvoices(ListInvoicesRequest) returns (ListInvoicesResponse);
  rpc CreateInvoice(CreateInvoiceRequest) returns (Invoice);
  rpc StreamInvoices(StreamInvoicesRequest) returns (stream Invoice);
}

message Invoice {
  string refnbr = 1;
  string customer_id = 2;
  string docdate = 3;
  double curyorigdocamt = 4;
  string status = 5;
}

Webhooks for event-driven APIs

Webhooks are the right tool when the consumer wants to be notified about events. The patterns:

For the broader webhook patterns, see the webhooks vs polling guide.

Contract testing

The consumer-producer contract must be tested. The patterns:

The schema that is not tested is a lie

An OpenAPI spec is a contract. A contract that is not tested is a lie. Run the contract test in CI for both the consumer and the producer. A failing contract test is a release blocker.

Wrapping up

REST for general use, GraphQL when the client has many views, gRPC for service-to-service, webhooks for events. The contract is the API; the contract test is the proof. Get the contract right and the integration works. Get the contract test right and the integration stays right.

Wrapping up

That is the working approach I use on Acumatica projects. The same patterns show up whether you are in Nairobi, Johannesburg, Kigali, Lusaka or Harare — and they are the things that keep work moving when an upgrade lands at 6 PM on a Friday. If you are stuck on something specific, reach out or keep reading through the rest of the Acumatica blog.

John Kihiu
John Kihiu
Acumatica ERP Developer · Laravel Engineer

Independent software engineer in Nairobi specialising in Acumatica customisations, Laravel backends, and tax fiscalisation integrations across East and Southern Africa.