I am using Spring Data REST. I am trying to unbind a collection association from an entity (item). i.e. - a property of the item is of List
type. I want to remove all items from that List
.
To do this, I am using the DELETE method:
curl -X DELETE …/categories/54ea0bcf27a2fb1b4641083a/fixedParentCategories
This gives me a 405 Method not allowed
error code. But, it works for a single valued association (when it is not of List
type). The documentation clearly lists DELETE
as a supported method for associations. I'd like to know if there is a way around this. Also, I tried using PUT
(Content-Type: text/uri-list) with an empty body, and it gives an error about missing request body. Other operations on this association are all working fine - I am able to add items to this collection, etc.
My entity looks like this:
@Document
public class Category {
@DBRef(lazy = true)
private List<Category> fixedParentCategories;
…
}