REST Api Design - Resource Modeling
- keep balance between coarse grained (only allow
POST /postsfor everything) and finer grained endpoints (multiple requests that have to be done for creating a single "Blog post" entity) - fine grained: more (control flow) business logic on the consumer; might result in issues with multiple consumers (duplicate logic); inconsistent states
- coarse grained only: business logic on API provider; rigid, hardly reusable, complex to handle on provider as well as consumer side
- escaping CRUD: model business processes as resources themselves:
/moneydeposit,/moneytransfer,/transaction - Consumer shouldn't be manipulating the internal state representation; it should express a user intent
- Nouns vs. verb approach: most verbs can be expressed as nouns, so...
Read full article from REST Api Design - Resource Modeling
No comments:
Post a Comment