|
|
|
|
|
by grncdr
4568 days ago
|
|
An alternative approach that I've implemented in the past [0] (and found quite useful) is client-driven server-side inlining of linked resources. What this means in practice is that the client specifies (usually with a query parameter) what related resources they are interested in, and the server can pre-fetch those resources and include them in the response. Obviously there's some upfront development costs and your API needs to have a well-linked taxonomy of resources, but it allows the client to create these 'flattened views' on the fly with no further work on your part. Edit: Just wanted to clarify that IMO this is a RESTful design because you are still using links to navigate your API resources, you're just writing a "smarter" server that can reduce the number of requests. [0] https://github.com/BetSmartMedia/lazorse-nesting edit: fixed link |
|