REST API Reference Version 5.1.1.0Search

cURL Code Sample

Note: The curl command below is a single line command and appears on two lines because of spacing limitations.
#############################################
# This sample script creates a volume,  
# retrieves a volume ID, offlines a volume,
# and deletes a volume.
#
# Note: Because of display width limitations,
# some of the cURL commands may appear 
# as multiple lines in in this sample.
# However, each cURL command is a single 
# line, not two or more lines. 
#############################################


#############################################
# Create a volume named myvol1 
# with size 1024MB 
#############################################

curl -i –-cacert ‘<array_cert_filename>’ -X 'POST' -d '{"data":{"name":"myvol1","size":"1024"}}' -H "X-Auth-Token:4a8f2bb051eec4e137fc450a85f941d7" https://<array_name>:5392/v1/volumes


############################################
# Retrieve the volume ID through read
############################################
curl -i –-cacert ‘<array_cert_filename>’ -X 'GET' -H "X-Auth-Token:4a8f2bb051eec4e137fc450a85f941d7" https://<array_management_name>:5392/v1/volumes?name=myvol1

############################################
# Offline the volume
############################################

curl -i –-cacert ‘<array_cert_filename>’ -X 'PUT' -d '{"data":{"online":"false"}}' -H "X-Auth-Token:4a8f2bb051eec4e137fc450a85f941d7" https://<array_name>:5392/v1/volumes/<object_id_of_myvol1>


############################################
# Delete the volume
############################################

curl -i –-cacert ‘<array_cert_filename>’ -X ‘DELETE' -H "X-Auth-Token:4a8f2bb051eec4e137fc450a85f941d7" https://<array_name>:5392/v1/volumes/< object_id_of_myvol1>