docs: correct DELETE response status code [DHIS2-17360]#1770
Open
karolinelien wants to merge 3 commits into
Open
docs: correct DELETE response status code [DHIS2-17360]#1770karolinelien wants to merge 3 commits into
karolinelien wants to merge 3 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
metadata.md— "Deleting objects": docs said a successfulDELETEreturns204 No Content. It actually returns200 OKwith aWebMessage/ObjectReportbody (AbstractCrudController.deleteObject→objectReport→ok()), and has across all supported versions. Corrected the statement and added an example body. Enforced by tests (e.g.LegendSetControllerTestasserts200/"OK").data-exchange.md— "Delete aggregate data exchange": response was labelled204 No Contentwhile the example body right below already showed the200 OKWebMessage/ObjectReport.AggregateDataExchangeController extends AbstractCrudController, so its DELETE returns200 OK— corrected the label.metadata.md— translations (PUT /api/{type}/{uid}/translations): docs said a validation error returns404 Not Found. It actually returns409 Conflict—TranslationsCheckreports errorE1106(e.g. duplicate property+locale) andreplaceTranslationsreturnsobjectReport(...), which resolves to a409WebMessage. The204 No Contentsuccess code was already correct here (this method sets@ResponseStatus(NO_CONTENT)). Also fixed the copy-paste "data value" wording. (The equivalent statement ini18n.mdalready correctly says409 Conflict, so it's left unchanged.)Reproduction (delete behaviour)
Verified live on play dev.
Notes
Documentation-only change. Returning real
204 No Contentfor 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