9 Custom methods
This chapter covers
- Why standard methods can’t cover all possible scenarios
- Using custom methods for cases where side effects are necessary
- How to use stateless custom methods for computation-focused API methods
- Determining the target for a custom method (resource versus collection)
Often, there will be actions we need to perform on our API resources that won’t fit nicely into one of the standard methods. And while these behaviors could technically be handled by the resource’s standard update method, the behavioral requirements of many of these operations would be quite out of place for a standard method, leading to a surprising, confusing, and overly complex interface. To address this, this pattern explores how to safely ...
Get API Design Patterns now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.