Assume I have "shape" as a resource. I have 2 shapes one 'square' with ID 123, and 'circle' with ID 456.
So when i do a GET on the 123 I will get a response : v1/foo/shapes/123
{
"id": "123",
"type": "square",
"side-lenght" : "6",
"area" : "36"
}
When i do a GET on 456 i will get a response : v1/foo/shapes/456
{
"id": "456",
"type": "circle",
"radius" : "7",
"area" : "154"
}
Is it better to send different responses based on the type,
(or)
Should i have 2 different types of resources altogether, having separate URI's such as
v1/foo/shapes/squares/123
, and v1/foo/shapes/circles/456
, so that the client does not have to parse the response based on the "type" in the response.