Skip to content

Commit

Permalink
rest: Document new /rest/config endpoints (#580)
Browse files Browse the repository at this point in the history
  • Loading branch information
imsodin committed Oct 23, 2020
1 parent 457e047 commit 1b9d39e
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 2 deletions.
8 changes: 8 additions & 0 deletions dev/rest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ System Endpoints

../rest/system-*

Config Endpoints
----------------

.. toctree::
:maxdepth: 1

/rest/config/... <../rest/config.rst>

Database Endpoints
------------------

Expand Down
53 changes: 53 additions & 0 deletions rest/config.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Config Endpoints
================

.. versionadded:: 1.12.0

These endpoints facilitate access and modification of the :ref:`configuration
<config>` in a granular way. Config sent to the endpoints must be in the same
format as returned by the corresponding GET request. When posting the
configuration succeeds, the posted configuration is immediately applied, except
for changes that require a restart. Query :ref:`rest-config-insync` to check if
a restart is required.

For all endpoints supporting ``PATCH``, it takes the existing config and
unmarshals the given JSON object on top of it. This means all child objects will
replace the existing objects, not extend them. For example for
``RawListenAddresses` in options, which is an array of strings, sending
``{RawListenAddresses: ["tcp://10.0.0.2"]`` will replace all existing listen
addresses.

.. _rest-config:

/rest/config
------------

``GET`` returns the entire config and ``PUT`` replaces it.

.. _rest-config-insync:

/rest/system/config/insync
--------------------------

``GET`` returns whether the config is in sync, i.e. whether the running configuration is
the same as that on disk or if a restart is required.

/rest/config/folders, /rest/config/devices
------------------------------------------

``GET`` returns all folders respectively devices as an array. ``PUT`` takes an array and
``POST`` a single object. In both cases if a given folder/device already exists,
it's replaced, otherwise a new one is added.

/rest/config/folders/\*id\*, /rest/config/devices/\*id\*
--------------------------------------------------------

Put the desired folder- respectively device-ID in place of \*id\*. ``GET``
returns the folder/device for the given ID, ``PUT`` replaces the entire config
and ``PATCH`` replaces only the given child objects.

/rest/config/options, /rest/config/ldap, /rest/config/gui
---------------------------------------------------------

``GET`` returns the respective object, ``PUT`` replaces the entire object and
``PATCH`` replaces only the given child objects.
4 changes: 4 additions & 0 deletions rest/system-config-get.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
GET /rest/system/config
=======================

.. deprecated:: v1.12.0
This endpoint still works as before but is deprecated. Use :ref:`rest-config`
instead.

Returns the current configuration.

.. code-block:: json
Expand Down
6 changes: 4 additions & 2 deletions rest/system-config-insync-get.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.. _rest-config-insync:

GET /rest/system/config/insync
==============================

.. deprecated:: v1.12.0
This endpoint still works as before but is deprecated. Use
:ref:`rest-config-insync` instead.

Returns whether the config is in sync, i.e. whether the running
configuration is the same as that on disk.

Expand Down
4 changes: 4 additions & 0 deletions rest/system-config-post.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
POST /rest/system/config
========================

.. deprecated:: v1.12.0
This endpoint still works as before but is deprecated. Use :ref:`rest-config`
instead.

Post the full contents of the configuration, in the same format as returned by
the corresponding GET request. When posting the configuration succeeds,
the posted configuration is immediately applied, except for changes that require a restart. Query
Expand Down

0 comments on commit 1b9d39e

Please sign in to comment.