liveBook · Manning

Rpc-oriented api

As explained in API Design Patterns

An RPC-oriented API organizes its interface primarily around named operations that perform actions, typically by invoking remote procedures.

An RPC-oriented API organizes its interface around named operations that perform actions. This style works well for stateless functionality but becomes harder to use when requests depend on stored state or prior calls. section 1.3

Stateful RPC interfaces can create practical consistency problems:

  • Clients must memorize many subtly different methods, such as RescheduleFlight() and CancelReservation(). section 1.3
  • Synonymous operations can receive inconsistent names, such as ShowAllFlights(), ListFlights(), and ListAllFlights(). section 1.3
  • Standardized Create, Get, List, Delete, and Update operations reduce this variation by organizing methods around resources. section 1.3
Table 1.1 Summary of methods for an example flight-booking API (view table figure)

Method

Description

ScheduleFlight()

Schedules a new flight

GetFlightDetails()

Shows information about a specific flight

ShowAllBookings()

Shows all travel plans currently booked

CancelReservation()

Cancels an existing flight reservation

RescheduleFlight()

Reschedules an existing flight to another date or time

UpgradeTrip()

Upgrades from economy class to first class

Compare the descriptive but inconsistent operations in a flight-booking RPC interface. section 1.3

How API Design Patterns covers it

How deep it goes
Contrasts stateless and stateful calls, then shows how inconsistent operation names motivate resource-oriented standardization.
Examples
Uses flight-booking operations including ScheduleFlight(), CancelReservation(), RescheduleFlight(), and standardized flight-reservation methods.
What you can do after
Evaluate operation naming and apply standardized CRUD methods when inconsistent RPC interfaces need greater predictability.
How it connects
Connects RPC-oriented APIs with stateless APIs, stateful APIs, and resource-oriented APIs.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of API Design Patterns. The section links point to the parts of the book it draws on.