0

I'm unsure of REST best practise in the following scenario:

GET /Customer/23 = returns Customer = OK

GET /Customer/23/Orders

In the second request should a Customer AND the Orders be returned, or should just the Orders be returned?

2

One of the principles in REST is that you have one URL to retrieve a particular resource through. For "Customer 23", this URL is /Customer/23.

If you start returning the Customer resource also from /Customer/23/Orders, you suddenly have two URLs to retrieve that Customer resource, with the associated questions what the difference is between those two Customer resources.

For that reason, /Customer/23/Orders should only return the resource that represents a list of orders.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.