liveBook · Manning

Import failure

As explained in API Design Patterns

An import failure is an unsuccessful attempt to read externally supplied data or create its resources in an API.

An import failure occurs when externally supplied data cannot be read or its resources cannot be created. Treat it differently from export failure: retrying may not help and may create duplicates. section 23.3.7

Handle the main failure modes explicitly:

  • Report entries that fail validation in the long-running operation results; retries cannot fix invalid data. section 23.3.7
  • Assume a transient failure may have created resources before stopping, so a retry can produce duplicates. section 23.3.7
  • Use a transaction when supported and appropriately sized, but recognize that some storage systems lack full transactional semantics or cannot handle enormous transactions. section 23.3.7

Request identifiers for deduplication

Represent imported resources with stable request identifiers, such as `{ importRequestId: "abc", sender: "users/1", content: "hi" }`, so repeated attempts can be distinguished. section 23.3.7

How API Design Patterns covers it

How deep it goes
Distinguishes validation and transient failures, explains partial creation and transaction trade-offs, and points toward deduplication.
Examples
Uses sample JSON resources containing import request IDs, senders, and content to illustrate deduplication.
What you can do after
Diagnose validation versus transient failures and design retries that avoid duplicate resource creation.
How it connects
Connects validation errors, retries, long-running operations, transactions, and deduplication.

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.