AOS-CX 10.07 REST v1 API GuideHelp Center
Example: User management using REST APIs
Creating a user
Example method and URI:
POST "https://192.0.2.5/rest/v1/system/users"
Example request body:
{…“名称”:“myadmin”、“通过word": "P@ssw0rd", "user_group": "/rest/v1/system/user_groups/administrators", "origin": "configuration" ... }
Example curl command:
$ curl --noproxy -k -X POST \ -b /tmp/auth_cookie \ "https://192.0.2.5/rest/v1/system/users” –d '{ ... "name": "myadmin", "password": "P@ssw0rd", "user_group": "/rest/v1/system/user_groups/administrators", "origin": "configuration" ... }'
On successful completion, the switch returns response code 201 Created.
改变密码
Example method and URI:
PUT "https://192.0.2.5/rest/v1/system/users/myadmin"
Example request body:
{ "password": "P@ssw0rd2g" }
Example curl command:
$ curl --noproxy -k -X PUT \ -b /tmp/auth_cookie \ "https://192.0.2.5/rest/v1/system/users/myadmin” –d '{ "password": "P@ssw0rd2g" }'
On successful completion, the switch returns response code 200 OK.
Deleting a user
Example method and URI:
DELETE "https://192.0.2.5/rest/v1/system/users/myadmin"
Example curl command:
$ curl --noproxy -k -X DELETE \ -b /tmp/auth_cookie \ "https://192.0.2.5/rest/v1/system/users/myadmin"
On successful completion, the switch returns response code 204 No Content.