Commercetools
Advanced

API Extensions for Synchronous Business Logic

Design API Extensions for validation and mutation without making every cart update depend on slow enterprise services.

55 min
3 sections
api-extensions
synchronous
validation
1
2
3

01. Know the blast radius

Section 1 of 3

API Extensions are called after a create or update request is processed but before the result is persisted. They can validate or apply additional update actions. Because they sit inside the write path, their latency and failures directly affect the original API call.

text
API Extension fit:

Good:
- validate purchase order policy
- enforce restricted goods shipping rule
- attach derived compliance custom field

Risky:
- call three slow enterprise systems
- run fraud machine learning synchronously on every cart update
- perform long-running OMS allocation
- send email or analytics events
Back to Course