summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2024-03-19 19:21:41 +0100
committerGitHub <noreply@github.com>2024-03-19 19:21:41 +0100
commite4931c26b258f062e0799d352b4df716312e0cad (patch)
tree895e60037389ea584071ffe058957598caf4ecec
parentd21e78c233a97680ccc423fc598d79aaa116aed6 (diff)
parent45a9ed96681a633d8c45f860228d4c44a9b2ad9f (diff)
downloadvyos-documentation-e4931c26b258f062e0799d352b4df716312e0cad.tar.gz
vyos-documentation-e4931c26b258f062e0799d352b4df716312e0cad.zip
Merge pull request #1336 from vyos/mergify/bp/sagitta/pr-1331
http-api: T6135: add details on op 'exists' for retrieve endpoint (backport #1331)
-rw-r--r--docs/automation/vyos-api.rst32
1 files changed, 32 insertions, 0 deletions
diff --git a/docs/automation/vyos-api.rst b/docs/automation/vyos-api.rst
index 8fad05ca..60247fae 100644
--- a/docs/automation/vyos-api.rst
+++ b/docs/automation/vyos-api.rst
@@ -125,6 +125,38 @@ For example, get the addresses of a ``dum0`` interface.
"error": null
}
+To check existence of a configuration path, use the ``exists`` operation.
+
+For example, check an existing path:
+
+.. code-block:: none
+
+ curl -k --location --request POST 'https://vyos/retrieve' \
+ --form data='{"op": "exists", "path": ["service","https","api"]}' \
+ --form key='MY-HTTPS-API-PLAINTEXT-KEY'
+
+ response:
+ {
+ "success": true,
+ "data": true,
+ "error": null
+ }
+
+versus a non-existent path:
+
+.. code-block:: none
+
+ curl -k --location --request POST 'https://vyos/retrieve' \
+ --form data='{"op": "exists", "path": ["service","non","existent","path"]}' \
+ --form key='MY-HTTPS-API-PLAINTEXT-KEY'
+
+ response:
+ {
+ "success": true,
+ "data": false,
+ "error": null
+ }
+
/reset
======