spring-projects / spring-data-rest

Simplifies building hypermedia-driven REST web services on top of Spring Data repositories
https://spring.io/projects/spring-data-rest
Apache License 2.0
916 stars 562 forks source link

POST PUTon associations throws http 405 [DATAREST-777] #1110

Open spring-projects-issues opened 8 years ago

spring-projects-issues commented 8 years ago

Florian GOURMELEN opened DATAREST-777 and commented

Hi,

I'm facing a problem updating the association resources

I have an object record that is related to a person (OneToMany) and an object Document that is related to n records (ManyToMany)

When I want to delete the association of a person to a record this uri works fine

However when I want to put back the relation to that person then I get http 405: Request method 'PUT' not supported

I get the same problem when trying to add a record to a document

none of these methods seems to be supported

I tried posting the full json containing the associations but no more luck

{"label" : "DocumentFlo", "records" : [{ "id": 1, "label" : "Record1" }]}

then I get "Cannot resolve URI id. Is it local or remote? Only local URIs are resolvable"

but in the doc it's mentionned that all those things are possible, am I doing something incorrect? http://docs.spring.io/spring-data/rest/docs/2.5.0.M1/reference/html/#repository-resources.association-resource

I've attached my sample project

thanks in advance


Attachments:

spring-projects-issues commented 8 years ago

Florian GOURMELEN commented

my bad My content type was incomplete I had to put text/uri-list now it workfs as expected

but its sad that we cannot post or put the full entity containing the associations as json at once