Chapter 4 Configuring Http Api - Cisco 340 Series Configuration Manual

Table of Contents

Advertisement

System API
System API
Use the commands in this section to configure the system API.
curl is used as a sample tool to request APIs. localhost is used as a sample IP address of the
Note
Cisco Edge 340 series, and cisco123! is used as a sample admin password.
Set Account
Example: set the password of root to cisco123!
Request
curl -k -X PUT -H 'password: cisco123!' -H 'Content-Type: application/json' -d '{"account"
: "root cisco123!"}' https://localhost/api/2.0/sys/account
Reply
{"success":"true","updatedAt":"2013-05-10 14:36:09"}
Parameter Restrictions
The first parameter of account should be an existing user. The new PASSWORD should contain
characters from at least three of the following classes:
lower case letters, upper case letters, digits, and special characters.
No character in the new PASSWORD can be repeated more than three times consecutively. The new
PASSWORD should neither be the same as the associated username, nor a reversed username.
PASSWORD length should follow the restrictions (between the minimum length and maximum length).
Get CPU
Example: get CPU
Request
curl -k -X GET -H 'password: cisco123!' https://localhost/api/2.0/sys/cpu
Reply
{"cpu":"0.1%us
Get Memory
Example: get memory
Request
curl -k -X GET -H 'password: cisco123!' https://localhost/api/2.0/sys/memory
Reply
{"memory":"Mem
Free:0","success":"true","getAt":"2013-05-08 11:43:46"}
Cisco Edge 340 Series Software Configuration Guide, Release 1.0
4-2
0.1%sy","success":"true","getAt":"2013-05-08 11:43:40"}
Total:2001 Used:1236 Free:764\nSwap Total:0 Used:0
Chapter 4
Configuring HTTP API
OL-29491-01

Advertisement

Table of Contents
loading

Table of Contents