Usage examples in CURL
Review this section for code examples that are generated using curl. You can use this information as reference for performing different procedures.
Notes:
Each curl example takes the following
form:
curl -k -X POST -H header_1 -H header_2... -d
‘JSON’ https://system_ip:7443/rest/target
Where the following definitions apply:
Authentication
The following is an example of the correct procedure for authenticating. You authenticate by
first producing an authentication token and then using that token in all future commands until the
session ends. For more information on authentication, see Authentication overview and API management.
curl -k -X POST -H 'Content-Type: application/json' -H 'X-Auth-Username:
superuser' -H 'X-Auth-Password: passw0rd'
https://192.168.10.109:7443/rest/auth
This yields an authentication token that you use for all other
commands.
{"token": "38823f60c758dca26f3eaa17dc4664964905a6f058ae2ec92e0f0b63fcf08a3e"}
Making an array
You can use commands only after authentication, including the command to make an array on the
system. The following example demonstrates the use of the token in place of the authentication
headers used in the authentication
process.
curl -k -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token:
38823f60c758dca26f3eaa17dc4664964905a6f058ae2ec92e0f0b63fcf08a3e'
-d '{"level": "draid6", "drive": "6:7:8:9:10", "draid6grp"}'
https://192.168.10.109:7443/rest/mkarray
Changing array settings
The next example shows how to modify an array member's attributes to change member
24
for new drive 15
by using a distributed rebuild to a rebuild
area:curl -k -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token:
38823f60c758dca26f3eaa17dc4664964905a6f058ae2ec92e0f0b63fcf08a3e'
-d '{"member": "24", "newdrive": "15",
"immediate": "0"}' https://192.168.10.109:7443/rest/charraymember
Removing the array
The final example shows how to remove an array MDisk from the storage pool. For more information on managing the array, see rmarray.
curl -k -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token:
38823f60c758dca26f3eaa17dc4664964905a6f058ae2ec92e0f0b63fcf08a3e'
-d '{"mdisk": "6", "mdiskgrp_10"}' https://192.168.10.109:7443/rest/rmarray