Sobes.tech
Senior

What does naming in RPC style mean? In our case, gRPC and REST — how do they differ?

sobes.tech AI

Answer from AI

Naming in the style of RPC (Remote Procedure Call) means that the API is focused on calling procedures or methods, rather than working with resources. In this style, methods are usually named as actions, for example: CreateUser, GetOrder, UpdateProfile.

gRPC is a framework for implementing RPC using the HTTP/2 protocol and serialization protocols (protobuf). It is strictly focused on calling methods with clearly defined input and output messages.

REST is an architectural style focused on working with resources through standard HTTP methods (GET, POST, PUT, DELETE). Naming in REST usually reflects resources, for example /users, /orders/123.

Main differences:

  • Naming: RPC — actions (verbs), REST — resources (nouns).
  • Protocol: gRPC uses HTTP/2 and protobuf, REST — HTTP/1.1 or HTTP/2 with JSON.
  • Structure: gRPC is strictly typed, REST is more flexible.

Example of a gRPC method:

rpc GetUser(GetUserRequest) returns (User);

Example of a REST request:

GET /users/{id}

Thus, gRPC is an implementation of RPC with modern technologies, while REST is another approach focused on resources and standard HTTP methods.