Let's say I have a database with customers and their orders. Each customer has general information like name, address, etc. Each order has information on items purchased, amount paid etc. The database is exposed through a RESTful API.
Presumably, a GET on a RESTful API URL like
/customers/101/orders/47/
would be expected to return the info (items purchased, amount paid, etc) for order 47 by customer 101.
I presume also that a GET on the following URL:
/customers/101/orders/
would be expected to return the information on all orders by customer 101.
However, what should a GET on the following URL return?
/customers/101/
- Should it return all orders by customer 101?
- Should it return just the name, address, etc of customer 101?
- Should it return all orders by customer 101 and their name, address etc?
My question obviously assumes that there is a "right answer" or recommended best practice for what RESTful API URLs should return.