Skip to content

docs: correct DELETE response status code [DHIS2-17360]#1770

Open
karolinelien wants to merge 3 commits into
masterfrom
DHIS2-17360
Open

docs: correct DELETE response status code [DHIS2-17360]#1770
karolinelien wants to merge 3 commits into
masterfrom
DHIS2-17360

Conversation

@karolinelien

@karolinelien karolinelien commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Corrects several inaccurate HTTP status codes documented for write operations on metadata objects. All verified against the code (AbstractCrudController) on supported versions (2.41, 2.42, 2.43, master).

Changes

  1. metadata.md — "Deleting objects": docs said a successful DELETE returns 204 No Content. It actually returns 200 OK with a WebMessage/ObjectReport body (AbstractCrudController.deleteObjectobjectReportok()), and has across all supported versions. Corrected the statement and added an example body. Enforced by tests (e.g. LegendSetControllerTest asserts 200/"OK").

  2. data-exchange.md — "Delete aggregate data exchange": response was labelled 204 No Content while the example body right below already showed the 200 OK WebMessage/ObjectReport. AggregateDataExchangeController extends AbstractCrudController, so its DELETE returns 200 OK — corrected the label.

  3. metadata.md — translations (PUT /api/{type}/{uid}/translations): docs said a validation error returns 404 Not Found. It actually returns 409 ConflictTranslationsCheck reports error E1106 (e.g. duplicate property+locale) and replaceTranslations returns objectReport(...), which resolves to a 409 WebMessage. The 204 No Content success code was already correct here (this method sets @ResponseStatus(NO_CONTENT)). Also fixed the copy-paste "data value" wording. (The equivalent statement in i18n.md already correctly says 409 Conflict, so it's left unchanged.)

Reproduction (delete behaviour)

POST   /api/userGroups {"name":"..."}   -> 201 Created
DELETE /api/userGroups/{id}             -> 200 OK + WebMessage/ObjectReport body

Verified live on play dev.

Notes

Documentation-only change. Returning real 204 No Content for deletes would be a breaking API change across every metadata DELETE endpoint (and would drop the informative response body), so the docs are corrected to match the implementation rather than the other way around.

The reported programRules case (DELETE /api/programRules/{id}) is the same generic metadata-delete behaviour and is covered by change #1 — the programRules section itself makes no status-code claim, so no change is needed there.

Resolves DHIS2-17360.

AI Assisted

The developer manual stated that a successful metadata DELETE returns
HTTP 204 (no content). The API actually returns 200 OK with a WebMessage
body wrapping an ObjectReport for the deleted object, and has done so
across all supported versions. Update the docs to match the actual,
long-standing behaviour.

AI Assisted
The "Delete aggregate data exchange" response was documented as
204 No Content while the example body right below it shows the actual
200 OK WebMessage/ObjectReport. AggregateDataExchangeController extends
AbstractCrudController, so its DELETE returns 200 OK like all other
metadata deletes. Correct the documented status code.

AI Assisted
PUT /api/{type}/{uid}/translations returns 409 Conflict (not 404 Not
Found) on a validation error such as a duplicate property+locale pair:
TranslationsCheck adds an ObjectReport with error E1106, and
replaceTranslations returns objectReport(...) which resolves to a 409
WebMessage. The 204 No Content success code was already correct. Also
fix the copy-paste "data value" wording (this endpoint saves
translations).

AI Assisted
@karolinelien karolinelien marked this pull request as ready for review June 30, 2026 10:53
@karolinelien karolinelien requested a review from netroms June 30, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant