Restful API design, is it reasonable to correspond one resource to two or more model,?

there are no particularly appropriate examples in hand. Cite one blindly.

authors and books.

author-- id,name,age
book-- id,name,price

API: 127:0.0.1/author/1
returns the names and prices of all books and books of the author whose id is 1

is this design reasonable?

Sep.30,2021

unreasonable

/ authors/1/books is to query author 1's book
detailed design can be found in my Mu course https://www.imooc.com/learn/811


in terms of interface design, this is unreasonable.
restful is often accompanied by additions, deletions and changes, so when designing interfaces, the logic of these three operations will become strange, such as adding authors and books is the same interface? There are two authors in a book. How can I add it?

the following personal feelings
however, it is unreasonable to talk about design out of demand, and it is also unreasonable to blindly carry out academic design. Personally, I do not want to blindly pursue the so-called restful. The ultimate goal of restful is easy to understand, not an examination. Points will be deducted if you choose wrong.

Menu