summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Göhler <github@ghlr.de>2024-03-18 22:40:27 +0100
committerGitHub <noreply@github.com>2024-03-18 22:40:27 +0100
commit9d8e37854de580e61e0902fd9530337cd079adc9 (patch)
tree045756bf5c32fafe3afb41a54ac8d2f89b6febb9
parent44dd53b5f4b8f2f8cadd5e4e0e96787a722e0d15 (diff)
parent72c4b47d4d9803fd376b8f510c7e3f08a2b60d19 (diff)
downloadvyos-documentation-9d8e37854de580e61e0902fd9530337cd079adc9.tar.gz
vyos-documentation-9d8e37854de580e61e0902fd9530337cd079adc9.zip
Merge pull request #1331 from jestabro/http-api-exists
http-api: T6135: add details on op 'exists' for retrieve endpoint
-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
======