From 45a9ed96681a633d8c45f860228d4c44a9b2ad9f Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Mon, 18 Mar 2024 14:06:58 -0500 Subject: http-api: T6135: add details on op 'exists' for retrieve endpoint (cherry picked from commit 72c4b47d4d9803fd376b8f510c7e3f08a2b60d19) --- docs/automation/vyos-api.rst | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'docs/automation/vyos-api.rst') 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 ====== -- cgit v1.2.3