Cisco Cisco Prime Home 6.3 Developer's Guide

Page of 78
Cisco Prime Home – Integration Guide
 
 
OL-28557-01   v5.0.1
 
66 
Deprecated 
 
The following examples make use of deprecated APIs. However, they are still 
included in this guide as the principles involved remain valid. 
 
Changing SSID with CURL 
 
#!/bin/sh 
 
BASEURL=http://localhost:9080/prime-home/api/current 
USER=admin 
PASS=admin 
 
CODE=$1 
SSID=$2 
 
if [ -z "$CODE" ]; then 
echo "must supply a code" 
exit 1 
fi 
 
if [ -z "$SSID" ]; then 
echo "must supply a ssid" 
exit 1 
fi 
 
EXP=$(cat << EOS 
s/\"Settings.WLANConfigurations.1.SSID\":\"[^\"]*\"/\"Settings.WLAN 
Configurations.1.SSID\":\"$SSID\"/ 
EOS 

 
N=`basename $0` 
TMP=`mktemp ./${N}.XXXXX` 
 
curl -u "$USER:$PASS" $BASEURL/subscribers/code:$CODE | sed -E -e 
$EXP > $TMP 
curl -X PUT -d @$TMP -u $USER:$PASS $BASEURL/subscriber/code:$CODE 
 
rm $TMP