spring-projects / spring-projects/spring-data-rest

Documentation is wrong: POST to spring data rest collection endpoint [DATAREST-975]

Open
#1,297 3 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

type: bug type: documentation
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Robert Rackl opened DATAREST-975 and commented

GIVEN a child repository that references a parent repository
AND both repositories are exposed as HATEOAS rest services.
AND the parent repository already contains some rows.

WHEN you know want to ADD another child that references this existing parent,

THEN you send a POST request to the URI, e.g

POST http://localhost:8080/api/parent/1/children

The documentation sais you should send a header application/json. But it does not specifiy the JSON format what to send.

WORKAROUND: You can send a Content-Type: "text/uri-list" and only send the URI of the child you want to add.

curl -X POST -H "Content-Type: text/uri-list" -H "Cache-Control: no-cache" -d 'http://localhost:8090/liquido/v2/users/2' "http://localhost:8090/liquido/v2/ideas/1/supporters"

Suggestion: Update the documentation and specify exaxtly what to send


Reference URL: http://docs.spring.io/spring-data/rest/docs/current/reference/html/#_supported_http_methods

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.