Skip to main content

Hi Everyone,

 

I am trying to update storage policy copy retention but i am not having a much luck.

In the command center you can edit the plan then edit Backup Destinations which are storage polices and it generates an Equivalent API and JSON payload, but when i post to URL it generates i am just getting a return off storagepool list. 

 

 

 

is this the correct location post:

https://mycommserve/commandcenter/api/StoragePool?Action=copyEdit

 

what i am trying to achieve is that updating retention rule for “retainBackupDataForDays” in number of secondary copy policies. 

is there any sample that can help? 

 

Thank you! 

 

Hello,

you just need to send a POST request with the following in the request body.

sample body

{
"newCopyName": "secondary",
"storagePolicyCopyInfo": {
"StoragePolicyCopy": {
"copyId": <copyId>,
"storagePolicyId": <storagePolicyId>
},
"copyType": "SYNCHRONOUS",
"isDefault": "SET_FALSE",
"isSnapCopy": "DO_NOT_CHANGE",
"extendedFlags": {
"useGlobalStoragePolicy": "SET_TRUE"
},
"retentionRules": {
"retainBackupDataForDays": 7,
"retainBackupDataForCycles": 1,
"retainArchiverDataForDays": -1
},
"useGlobalPolicy": {
"storagePolicyId": <storagePolicyId>,
"storagePolicyName": "storagePolicyName"
},
"startTime": {
"time": -1
},
"sourceCopy": {
"copyId": <copyId>,
"copyName": "<copyName>"
},
"dedupeFlags": {
"enableDASHFull": "SET_TRUE"
}
}
}

example

change retainBackupDataForDays for backup destination name “secondary

curl --location 'http://WebConsoleHostName/webconsole/api/StoragePool?Action=copyEdit' \
--header 'Accept: application/json' \
--header 'Authtoken: QSDK token would be auto set after POST Login is called.'' \
--header 'Content-Type: application/json' \
--data-raw '{
"newCopyName": "secondary",
"storagePolicyCopyInfo": {
"StoragePolicyCopy": {
"copyId": 1085,
"storagePolicyId": 52
},
"copyType": "SYNCHRONOUS",
"isDefault": "SET_FALSE",
"isSnapCopy": "DO_NOT_CHANGE",
"extendedFlags": {
"useGlobalStoragePolicy": "SET_TRUE"
},
"retentionRules": {
"retainBackupDataForDays": 7,
"retainBackupDataForCycles": 1,
"retainArchiverDataForDays": -1
},
"useGlobalPolicy": {
"storagePolicyId": 27,
"storagePolicyName": "cvstu"
},
"startTime": {
"time": -1
},
"sourceCopy": {
"copyId": 1082,
"copyName": "Primary"
},
"dedupeFlags": {
"enableDASHFull": "SET_TRUE"
}
}
}'

if you need, you can get info for Storage Policy use next GET request

GET {{ServerUrl}}/V2/StoragePolicy

example

curl --location 'http://WebConsoleHostName/webconsole/api/V2/StoragePolicy' \
--header 'Authtoken: {{Token}}' \
--header 'Accept: application/json'

 and get “storagePolicyId” from output

example

...   
"policies": l

{
"numberOfStreams": 100,
"storagePolicy": {
"storagePolicyName": "PlanName",
"storagePolicyId": 18
}
...
]
...

and get details for policy by id (storagePolicyId) use next GET request

GET {{ServerUrl}}/V2/StoragePolicy/18?propertyLevel=10

example

curl --location 'http://WebConsoleHostName/webconsole/api/V2/StoragePolicy/18?propertyLevel=10' \
--header 'Authtoken: {{Token}}' \
--header 'Accept: application/json'

and use the received data to form the desired POST request.

More details about API this https://api.commvault.com/#08b3c816-735b-46ce-a5f5-879629a6c504


thank you so much! This helped a lot! 


Reply