-2

Is it under the rules of REST to return a different model of 'order' if someone call:

/me/orders/222

Return values:
- OrderId
- Price

or

/customers/111/orders/222

Return values:
- OrderId
- Price
- Tags
- Risk
- Comment

Maybe the model of 'order' should always be the same instead of different endpoints? Or it can differ? Is there any rule?

2

1 Answer 1

0

There are no "rules of REST", but having two different objects with the same name is confusing. And that's basically what you have done here.

I would suggest using the same fields if they are the same thing, or choosing a different name, Item vs Order or whatnot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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