Project

General

Profile

Actions

Cleanup #47071

open

Feature #40907: mgr/dashboard: REST API improvements

mgr/dashboard/api: review PUT methods

Added by Ernesto Puerta over 3 years ago. Updated almost 3 years ago.

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.
Examples of endpoints requiring fix:
  • /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}: ...
Actions #1

Updated by Ernesto Puerta over 3 years ago

  • Parent task set to #40907
Actions #2

Updated by Nizamudeen A over 3 years ago

  • Assignee set to Nizamudeen A
Actions #3

Updated by Ernesto Puerta about 3 years ago

  • Project changed from mgr to Dashboard
  • Category changed from 146 to General - Back-end
Actions #4

Updated by Nizamudeen A almost 3 years ago

  • Assignee deleted (Nizamudeen A)
Actions

Also available in: Atom PDF