White Papers
Configuration details
19 Dell Storage Manager REST API Cookbook | 3089-WP-SAN
3 Working with the SC Series array
The primary functions and syntax of script is contained between the open and close code segments
discussed in sections 2.1 and 2.2. This paper provides simple guidance for the Python syntax to promote
readability and understanding of the use of REST API calls with the DSM Data Collector.
The following code assumptions are made:
• Assumes a true or successful condition (return code) from each requested REST API call
• Contains minimal error trapping and management to promote readability and understanding
• Creates the data structures required to facilitate passing the data between REST API calls
3.1 Server folders
Server folders enable the ability to logically group server objects by name, purpose, or other defined criteria.
Folder REST API calls used in this section
REST API
Method
/StorageCenter/ScServerFolder
POST
/StorageCenter/ScServerFolder/<instanceId>
PUT
DELETE
3.1.1 Create a server folder
# create Storage Center server folder object managed by DSM / SC 9
payload = {}
# user-defined string / folder name
payload['Name'] = 'RestTest'
payload['StorageCenter'] = scList['SC 9']['instanceId']
# Storage Center instanceId + ".0" represents (/) the root level folder
payload['Parent'] = scList['SC 9']['instanceId'] + ".0"
# user-defined string / notes
payload['Notes'] = 'Created via REST API'
REST = '/StorageCenter/ScServerFolder'
completeURL = '%s%s' % (baseURL, REST if REST[0] != '/' else REST[1:])
json_data = connection.post(completeURL
,data=json.dumps(payload
,ensure_ascii=False).encode('utf-8')
,headers=header
,verify=verify_cert)