Skip to content

Config PATCH/PUT/DELETE API #6540

Closed

Description

@calmh

Currently we just have the one config API endpoint, POST /rest/system/config to replace the whole thing. This isn't optimally easy to use from API clients that just want to change an option or two as you need a while get/change/post and there is also an inherent race condition.

It would be nice to have an API that can twiddle parts of the config easier and safer. From the outside it could look something like this:

  • PUT /rest/system/config/devices/5Y62GZS-... creates or replaces a single device in its entirety
  • DELETE /rest/system/config/folders/default deletes the default folder
  • PATCH /rest/system/config/devices/5Y62GZS-... overwrites the properties present in the given object only, which could be something like {"name": "Unused for now", "paused": true}.
  • PUT /rest/system/config/options/localAnnounceEnabled overwrites the named field in the config, in this case the JSON in the body needs to a boolean like false.
  • ... and so on

Implementation wise we can mostly just take the current config, JSON serialize it, traverse the resulting object according to the request path, and then remove, replace or unmarshal on top of the resulting leaf object, then commit. (Folders and devices handled specifically as they are arrays in the config object and not dicts.) This would happen while holding the API config lock, so it's atomic from an API perspective.

Activity

  1. added
    enhancement
    on May 13, 2020
  2. added a commit that references this issue on Sep 23, 2020
    f2d2295
  3. added a commit that references this issue on Oct 22, 2020
    f0f60ba
  4. added this to the v1.12.0 milestone on Oct 22, 2020
  5. added
    frozen-due-to-age
    on Oct 23, 2021
  6. locked and limited conversation to collaborators on Oct 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfrozen-due-to-age

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions