I am working on a CRUD application using spring-data-rest-webmvc.
I have a Product entity as below:-
{
"version": 0,
"displayName": "Test Product",
"_links": {
"self": {
"href": "http://localhost/services/data/products/123465"
},
"fixedParentCategories": {
"href": "http://localhost/services/data/products/123465/fixedParentCategories"
}
}
When I access the URL for the property "fixedParentCategories" (http://localhost/services/data/products/123465/fixedParentCategories), it returns a 404 (ResourceNotFoundException thrown and translated to 404).
The problem that I have here is that, this 404 response does not help me identify what type of objects go into this collection (fixedParentCategories).
If there is an item present in the collection, I get a response like below:-
{
"_embedded": {
"categories": [
{
"version": 0,
"displayName": "Test category",
"_links": {
"self": {
"href": "http://localhost:8080/services/data/categories/54c9963a8c21fbd950b6f1cf"
},
}
}
]
}
}
It clearly says that the items are of type "categories".
My question is: Is there any way of identifying the target item type when the collection is empty, so that the client side code can address it properly?