09-05-2019 01:42 PM
Looking for an example of the Data Method: Load in JSON-RPC.
I've seen the documentation:
{"th": <integer>,
"data": <string>
"path": <string, default: "/">
"format": <"json" | "xml", default: "xml">
"mode": <"create" | "merge" | "replace", default: "merge">}
Though anything I seem to try - attempting json-data - doesn't seem to work. The RPC always returns a
09-06-2019 12:14 AM
From the NSO Web UI Book, the load method's parameters are as stated
{"th": <integer>, "data": <string> "path": <string, default: "/"> "format": <"json" | "xml", default: "xml"> "mode": <"create" | "merge" | "replace", default: "merge">}
Did the JSON payload include a comma after the "data" string? It seems that the documentation is missing these, which results in invalid JSON.
A valid JSON-RPC parameter payload for the "load" method would loke something like
{"th": 42,
"data": "<config xmlns="http://tail-f.com/ns/config/1.0"><wrapper xmlns="urn:model"><name>create</name></wrapper></config>",
"mode": "create"}
Note that it should be possible to omit parameters with default values.
09-06-2019 02:03 AM
Of course the XML data above needs to escape quotes, e.g. ..."data": "<config xmlns=\"...\">...</config>".
09-06-2019 06:13 AM
thank you for the response.
Yes, we did notice the missing comma's and have included those.
Do you have a working example with JSON as the data parameter payload?
09-09-2019 01:57 AM
Given the following YANG model
module ex {
namespace "urn:ex";
prefix ex;
leaf value { type int32; }
}
The following JSON-RPC payload loads config
{"jsonrpc": "2.0",
"method": "load",
"params":
{"th": 1,
"data": "{\"ex:value\":42}",
"mode": "create",
"format": "json"},
"id":1}
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide