From 24fdb086d81c63aa2ff47e1b17804e068ea75be6 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Wed, 28 May 2025 17:29:59 -0500 Subject: T7498: add example of merge and of passing config in body of request --- docs/automation/vyos-api.rst | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'docs/automation/vyos-api.rst') diff --git a/docs/automation/vyos-api.rst b/docs/automation/vyos-api.rst index a9518a00..0955cca1 100644 --- a/docs/automation/vyos-api.rst +++ b/docs/automation/vyos-api.rst @@ -517,3 +517,34 @@ 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 + } -- cgit v1.2.3