summaryrefslogtreecommitdiff
path: root/docs/automation/vyos-api.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/automation/vyos-api.rst')
-rw-r--r--docs/automation/vyos-api.rst77
1 files changed, 77 insertions, 0 deletions
diff --git a/docs/automation/vyos-api.rst b/docs/automation/vyos-api.rst
index a9518a00..7b4a24df 100644
--- a/docs/automation/vyos-api.rst
+++ b/docs/automation/vyos-api.rst
@@ -517,3 +517,80 @@ To Load a configuration file.
"data": null,
"error": null
}
+
+To Merge a configuration file.
+
+.. code-block:: none
+
+ curl -k --location --request POST 'https://vyos/config-file' \
+ --form data='{"op": "merge", "file": "/config/test.config"}' \
+ --form key='MY-HTTPS-API-PLAINTEXT-KEY'
+
+ response:
+ {
+ "success": true,
+ "data": null,
+ "error": null
+ }
+
+In either of the last two cases, one can pass a string in the body of the
+request, for example:
+
+.. code-block:: none
+
+ curl -k --location --request POST 'https://vyos/config-file' \
+ --form data='{"op": "merge", "string": "interfaces {\nethernet eth1 {\naddress "192.168.2.137/24"\ndescription "test"\n}\n}\n"}' \
+ --form key='MY-HTTPS-API-PLAINTEXT-KEY'
+
+ response:
+ {
+ "success": true,
+ "data": null,
+ "error": null
+ }
+
+**************
+Commit-confirm
+**************
+
+For the previous two endpoints discussed, a ``commit`` command is implicit
+following a succesful request operation (``set | delete | load | merge``, or
+a list of ``set`` and ``delete`` operations). One can instead request a
+``commit-confirm`` command by including the field ``confirm_time`` of type
+int > 0. An example follows, in the alternative JSON format, for brevity,
+although the standard form-data format is fine:
+
+.. code-block:: none
+
+ curl -k -X POST -d '{"key": "MY-HTTPS-API-PLAINTEXT-KEY", "op": "merge", "string": "interfaces {\nethernet eth1 {\naddress '192.168.137.1/24'\ndescription 'internal'\n}\n}\n", "confirm_time": 1}' https://vyos/config-file
+
+ response:
+ {
+ "success": true,
+ "data": "Initialized commit-confirm; 1 minutes to confirm before reload\n",
+ "error": null
+ }
+
+The committed changes will be reverted at the timeout unless confirmed.
+To confirm and keep the changes:
+
+.. code-block:: none
+
+ curl -k -X POST -d '{"key": "MY-HTTPS-API-PLAINTEXT-KEY", "op": "confirm"}' https://vyos/config-file
+
+ response:
+ {
+ "success": true,
+ "data": "Reload timer stopped\n",
+ "error": null
+ }
+
+If allowed to revert to the previous configuration, the manner in which
+changes are reverted is governed by:
+
+.. code-block:: none
+
+ vyos@vyos# set system config-management commit-confirm action
+ Possible completions:
+ reload Reload previous configuration if not confirmed
+ reboot Reboot to saved configuration if not confirmed (default)