ehrbase icon indicating copy to clipboard operation
ehrbase copied to clipboard

Wrong documentation: PUT and POST Composition return 204 in case of success, not 200

Open flowrider3000 opened this issue 3 years ago • 4 comments

Configuration information

  • EHRbase version: 0.20.0-SNAPSHOT

Steps to reproduce

  1. Create a new EHR
  2. Create composition with https://specifications.openehr.org/releases/ITS-REST/latest/ehr.html#composition-composition-post
  3. Update composition with https://specifications.openehr.org/releases/ITS-REST/latest/ehr.html#composition-composition-put

Actual result

PUT: In case of success, API returns 204. POST: In case of success, API returns 204.

Expected result (Acceptance Criteria)

Docs for PUT and POST should be changed from HTTP 200 to HTTP 204.

Definition of Done

  • [ ] The defect is checked by an unit or an integration test (Robot)
  • [ ] Merge Request approved
  • [ ] Unit tests passed
  • [ ] Build without errors
  • [ ] Release notes prepared
  • [ ] No additional runtime warnings

flowrider3000 avatar Mar 01 '22 12:03 flowrider3000

Dear @flowrider3000

You are right and status code 204 No Content should definitively be listed in the responses. However, both codes are valid and depend on the Prefer header:

  • send Prefer: return=minimal to inform the service that prefers only a minimal response to a successful request. A Location header indicating the direct URL to access the resource MUST be part of the service response. If there is no payload content to be returned, the service SHOULD use HTTP status code 204 No Content.
  • send Prefer: return=representation to inform the service that prefers a full representation response to a successful request. A Location header indicating the direct URL to access the resource MAY be part of the service response, and the payload content SHOULD include a full representation.

https://specifications.openehr.org/releases/ITS-REST/latest/overview.html#design-considerations-representation-details-negotiation

subigre avatar Mar 11 '22 14:03 subigre

I closed it by mistake (clicking on the wrong button). I let you close the issue if I answered your question.

subigre avatar Mar 11 '22 15:03 subigre

Hi @subigre Thanks for the link to the Prefer header. Should we keep this issue open until 204 is added to the documentation? If not, the issue can be closed.

flowrider3000 avatar Mar 12 '22 12:03 flowrider3000

Hello @flowrider3000, Bug reported in JIRA https://jira.vitagroup.ag/browse/CDR-460 for tracking purposes. Will let you know in case of any updates.

vladislavploaia avatar Jul 11 '22 07:07 vladislavploaia