spring-projects / spring-projects/spring-data-rest
POST PUTon associations throws http 405 [DATAREST-777]
@odrotbohm is already working on this.
Since Dec 31, 2020.
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
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
- uri: http://localhost:8080/records/1/person
- method: DELETE
However when I want to put back the relation to that person then I get http 405: Request method 'PUT' not supported
- uri: http://localhost:8080/records/1/person
- method: PUT
- content type Text
- body http://localhost:8080/persons/1
I get the same problem when trying to add a record to a document
- uri: http://localhost:8080/documents/1/records
- method: POST or PUT
- content type Text
- body http://localhost:8080/document/1
none of these methods seems to be supported
I tried posting the full json containing the associations but no more luck
- uri: http://localhost:8080/documents
- method: POST
- content type: json
- body:
{"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:
- al-server.zip (279.05 kB)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.