Using CURL to invoke Restconf NBI

Curl with Basic Auth


#!/bin/bash
set -x


echo "invoking restconf nbi"
export REST_HOST=192.168.67.20
curl -k -i -c cookies.txt \
-H "accept: application/json" -X GET https://$REST_HOST/restconf/data/v1/cisco-customer:customer --user root:Public123

curl -k -i -b cookies.txt \
-H "accept: application/json" -X GET https://$REST_HOST/restconf/data/v1/cisco-customer:customer

Curl with Spring Security

#!/bin/bash
set -x


echo "invoking restconf nbi"
export REST_HOST=192.168.67.20
curl -k -i -c cookies.txt \
-H "Content-type: application/x-www-form-urlencoded" -X POST https://$REST_HOST/webacs/j_spring_security_check \
-d "j_username=root&j_password=Public123" \

curl -k -i -b cookies.txt \
-H "accept: application/json" -X GET https://$REST_HOST/restconf/data/v1/cisco-customer:customer