[PR #18398] feat: change delete status code from 200 to 204 #28906

Closed
opened 2026-02-21 20:44:21 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/18398

State: closed
Merged: Yes


This pull request standardizes the HTTP response code for DELETE operations across various API endpoints. The primary change is updating the response code from 200 to 204 to better align with RESTful conventions, indicating successful deletion without returning a message body.

Standardization of HTTP Response Codes for DELETE Endpoints:

  • Updated the response code from 200 to 204 for successful deletion in the following files:
    • api/controllers/console/app/annotation.py (delete method for app_id and annotation_id)
    • api/controllers/console/app/ops_trace.py (delete method for app_id)
    • api/controllers/console/auth/data_source_bearer_auth.py (delete method for binding_id)
    • api/controllers/console/datasets/datasets_segments.py (multiple delete methods for dataset-related entities) [1] [2] [3]
    • api/controllers/console/datasets/external.py (delete method for external_knowledge_api_id)
    • api/controllers/console/datasets/metadata.py (delete method for dataset_id and metadata_id)
    • api/controllers/console/explore/installed_app.py (delete method for installed_app)
    • api/controllers/console/explore/saved_message.py (delete method for installed_app and message_id)
    • api/controllers/console/extension.py (delete method for id)
    • api/controllers/console/tag/tags.py (delete method for tag_id)
    • api/controllers/service_api/app/annotation.py (delete method for annotation_id)
    • api/controllers/service_api/app/conversation.py (delete method for c_id)
    • api/controllers/service_api/dataset/document.py (delete method for document_id)
    • api/controllers/service_api/dataset/metadata.py (delete method for metadata_id)
    • api/controllers/service_api/dataset/segment.py (multiple delete methods for segment-related entities) [1] [2]
    • api/controllers/web/saved_message.py (delete method for message_id)

This change ensures consistency and adherence to RESTful best practices across the codebase.# Summary

fix #18397

Screenshots

Before After
... ...

Checklist

Important

Please review the checklist below before submitting your pull request.

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/18398 **State:** closed **Merged:** Yes --- This pull request standardizes the HTTP response code for `DELETE` operations across various API endpoints. The primary change is updating the response code from `200` to `204` to better align with RESTful conventions, indicating successful deletion without returning a message body. ### Standardization of HTTP Response Codes for `DELETE` Endpoints: * Updated the response code from `200` to `204` for successful deletion in the following files: - `api/controllers/console/app/annotation.py` (`delete` method for `app_id` and `annotation_id`) - `api/controllers/console/app/ops_trace.py` (`delete` method for `app_id`) - `api/controllers/console/auth/data_source_bearer_auth.py` (`delete` method for `binding_id`) - `api/controllers/console/datasets/datasets_segments.py` (multiple `delete` methods for dataset-related entities) [[1]](diffhunk://#diff-16dec60e65d10cb01486aa0c7a05370aad08f5abccecee3c3955cc742e1b22edL134-R134) [[2]](diffhunk://#diff-16dec60e65d10cb01486aa0c7a05370aad08f5abccecee3c3955cc742e1b22edL336-R336) [[3]](diffhunk://#diff-16dec60e65d10cb01486aa0c7a05370aad08f5abccecee3c3955cc742e1b22edL593-R593) - `api/controllers/console/datasets/external.py` (`delete` method for `external_knowledge_api_id`) - `api/controllers/console/datasets/metadata.py` (`delete` method for `dataset_id` and `metadata_id`) - `api/controllers/console/explore/installed_app.py` (`delete` method for `installed_app`) - `api/controllers/console/explore/saved_message.py` (`delete` method for `installed_app` and `message_id`) - `api/controllers/console/extension.py` (`delete` method for `id`) - `api/controllers/console/tag/tags.py` (`delete` method for `tag_id`) - `api/controllers/service_api/app/annotation.py` (`delete` method for `annotation_id`) - `api/controllers/service_api/app/conversation.py` (`delete` method for `c_id`) - `api/controllers/service_api/dataset/document.py` (`delete` method for `document_id`) - `api/controllers/service_api/dataset/metadata.py` (`delete` method for `metadata_id`) - `api/controllers/service_api/dataset/segment.py` (multiple `delete` methods for segment-related entities) [[1]](diffhunk://#diff-5ebadef1e8a8d9f44d5c04c4893abe524c245621594674a7ad48c88d4cc64a16L162-R162) [[2]](diffhunk://#diff-5ebadef1e8a8d9f44d5c04c4893abe524c245621594674a7ad48c88d4cc64a16L347-R347) - `api/controllers/web/saved_message.py` (`delete` method for `message_id`) This change ensures consistency and adherence to RESTful best practices across the codebase.# Summary fix #18397 # Screenshots | Before | After | |--------|-------| | ... | ... | # Checklist > [!IMPORTANT] > Please review the checklist below before submitting your pull request. - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:44:21 -05:00
yindo closed this issue 2026-02-21 20:44:21 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#28906