REST + transactional?

Is it possible to do a transactional-based approach over the REST API? i.e., something similar to the J-style CLI where you enter config mode, bang out a bunch of commands, then validate and commit all at one time? Access to /api/running via REST does per interaction commits. Trying to do the same thing via /api/candidate doesn’t seem to get me very far (the existing configuration is not populated, and attempts to populate it are quietly ignored by the REST interface as far as I can tell…not even an HTTP error code comes back. This looked like the right way because of the commit operation, but I can’t seem to get any actual configuration data loaded)

Or is the better approach to use JSONRPC to do this? Are there any examples? Thanks!

We have tried to keep the REST interface as true to REST principles as possible, and so we have it stateless and each REST interaction becomes its own transaction. If you want to have transactional control, we of course recommend NETCONF :smile:

It should be possible to use the candidate datastore I believe via REST to collect a bunch of configuration changes, then committing them, although I am not aware of anyone doing this. If you can describe precisely what you tried, we can investigate this.

It is possible to use the JSON-RPC Web interface to start a transaction, populate the transaction, then commit the transaction. JSON-RPC supports a large subset of the general Management Agent API (MAAPI) which the other northbound interfaces make use of. The ConfD User’s Guide has a description of a common workflow in section 18.2 (from a WebUI perspective, and there is a description of the JSON-RPC for transactions in section 19.17 through 19.19.

Figured it out - have to do a _discard-changes before you do ANYTHING else…this solved my problem:

curl -u admin:admin --insecure -X POST

Things were MUCH happier after that…