Actions
Cleanup #47071
openFeature #40907: mgr/dashboard: REST API improvements
mgr/dashboard/api: review PUT methods
Status:
New
Priority:
Normal
Assignee:
-
Category:
General - Back-end
Target version:
-
% Done:
0%
Tags:
Backport:
Reviewed:
Affected Versions:
Pull request ID:
Description
Many ceph-dashboard endpoints support PUT method, but in most cases it's used to perform partial updates, which breaks RESTful architecture, as it may result in PUT no longer being idempotent.
Partial updates would require either POST (which could be suitable for Collection-like endpoints), or PATCH (which is optimal for single resource or multiple resource partial update).
HTTP does not specify any syntax for the PATCH body, so several proposals have arised:
- JSON Patch (http://jsonpatch.com): rather than a data structure, the body defines a sequence of operations (add, remove, replace, copy, move and test) to be performed on the existing resource JSON representation. To address JSON fields, it uses JSON pointers. Llibraries exist for Python and JS ([1], [2], ...).
- JSON Merge Patch is a simpler and more pragmatic approach, when no complex actions are required.
/cluster_conf
: alternative,PUT /cluster_conf/{option}
/host/{id}
: the PUT method only updates labels, so it's a partial update... Alternative approach:/host/{id}/labels
/mgr/module/{id}
: ...
Updated by Ernesto Puerta about 3 years ago
- Project changed from mgr to Dashboard
- Category changed from 146 to General - Back-end
Actions