liveBook · Manning

Long-running operations pattern

As explained in API Design Patterns

The long-running operations pattern is an API structure for representing work that continues after the initial request and exposing its status or result asynchronously.

The long-running operations pattern represents work that continues after an initial request. Instead of returning a completed result, an API returns an operation containing an identifier, completion state, eventual result or error, and optional metadata.

This structure improves asynchronous exports over a response that merely supplies a download location: consumers can inspect progress, while the operation metadata records completion percentage from 0 to 100. section 2.4.3

Exporting user messages

A POST to /{parent=users/*}/messages:export accepts an output configuration and returns Operation<ExportMessagesResponse, ExportMessagesMetadata>. The request can specify a file or Amazon S3 destination, compression, and encryption; the completed response echoes the output configuration.

How API Design Patterns covers it

How deep it goes
Defines a generic operation interface and progress metadata, but stops short of detailing every operational mechanism.
Examples
Demonstrates exporting messages to hosted files or Amazon S3 with optional Gzip compression and encryption.
What you can do after
Apply it by modeling asynchronous API responses with operation identifiers, completion state, typed results, errors, and progress metadata.
How it connects
Connects import/export patterns with pagination, metadata, output configuration, and common operation errors.

Also explained in

Compare how 2 books explain long-running operations pattern →

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.