Using cURL to access the API¶
These examples are simple demonstrations using cURL and shell commands. This makes it easy to demonstrate how the service works, and how RESTCONF URLs are formed, but may not make good practical examples.
In real-world cases these types of queries are handled by a program or script that interacts with RESTCONF, manipulating data directly and a lot of the details will be handled by RESTCONF and JSON programming libraries.
cURL Differences for CA+Certificate files vs PKCS#12 Archive¶
The cURL syntax in the examples varies depending on the client certificate export format.
For CA and certificate files exported separately, use this style:
$ curl -f --cert ~/tnsr/tnsr-restconf-client.crt \
--key ~/tnsr/tnsr-restconf-client.key \
--cacert ~/tnsr/tnsr-restconf-CA.crt \
[...]
Replace the filenames as needed.
For a PKCS#12 archive, use the following style:
$ curl -f --cert-type P12 --cert ~/tnsr/restconf-client.p12:'abc12345' \
[...]
Replace the filename and password as needed.
The examples below use the separate file style syntax, but both methods work.