Home/REST Track/Partial Success, Bulk Operations & Compensation

Partial Success, Bulk Operations & Compensation

Handle partial label creation, bulk workflows, and compensation steps without corrupting internal state.

Success and Failure Can Arrive Together

A carrier can create three labels, reject two parcels, and still return one transport-level success response. If you collapse that into a single pass/fail flag, your downstream systems will never know which parcels actually moved.

Compensation Is Part of the Write Path

When the carrier succeeded but your database write failed, you now own a split-brain workflow. Compensation might mean voiding the carrier artifact, replaying the internal save with idempotency, or parking the job in manual review. The right answer depends on what the carrier can still reverse safely.
Carrier Reality

Bulk manifest and multi-piece shipment APIs often blend accepted and rejected items in the same payload. The only safe implementation is to model each piece explicitly instead of pretending the whole batch has one status.

Bulk APIs Need Item-Level Evidence

Store per-item identifiers, failure reasons, and compensation status. If you cannot explain which child operation succeeded and which child operation failed, the post-incident cleanup will be slow, manual, and expensive.

Practice Drills

A carrier accepts a manifest but rejects two parcels inside it because customs data is incomplete. What should the integration avoid?

When normalizing carrier failures, separate decisions, decisions, and decisions so every upstream caller is not forced to reinterpret raw payloads.