a specific action that doesn’t really fit very well in one of the standard methods (ch7). 2. how to integrate to current systems or framework: ◦ should we try to jam the behavior we want into the existing methods, bending the framework a bit to fit our needs? Or ◦ should we change our behavior into a form that fits a bit more cleanly within the framework? Or ◦ should we change the framework to accommodate our new scenario? 4
another, and as a result, transitioning to a new state is fundamentally different from setting the value of a scalar field. a. This field feels like it should be managed by the API service itself rather than updated by the client. b. 狀態 (State) 的改變 (transition) 應該由 Service 管理,不是 POST 過來 2. As we learned in chapter 7, standard methods really should NOT do anything besides the specific action their name implies. 7
POST method and never use the PATCH method. They might use the GET method if the custom method is idempotent and safe. 2. Custom methods use a colon (:) character to separate the resource target from the action being performed (e.g., /missiles/1234:launch). 3. While side effects are forbidden for standard methods, they are permitted for custom methods. They should be used sparingly and documented thoroughly to avoid confusion for users. 4. In general, custom methods should target a collection when multiple resources from a single collection are involved. 5. Sometimes, particularly for computational work, APIs might choose to rely on stateless custom methods to perform the bulk of the work. This strategy should be used cautiously as it’s easy for statefulness to eventually become important and can be difficult to introduce later on. 20