Skip to main content

Good Day,

we are facing strange behaviour when trying to disassociate a subclient from a schedule policy using rest-api.

One client with multiple filesystem Subclients can be associated to different schedulepolicies. However, when trying to remove the association of just one Subclient for one client we see that to this particular Schedule-Policy is then associated to ALL File-System subclients on this client where we performend the Rest-PUT on.

$removeTask = @{"taskInfo"=@{"taskOperation"="5";"associations"=@{"clientName"="$client";"backupsetName"="defaultBackupSet";"appName"="file system"},@{"clientName"="$client";"subclientName"="$subclientname";"backupsetName"="defaultBackupSet";"appName"="file system";"flags"=@{"exclude"=$true}};"task"=@{"task"=@{"taskName"="$schdulepolicy"}}}} | ConvertTo-Json -Depth 5
Invoke-RestMethod "$commserver/webconsole/api/Task" -Method Put -Headers $headers -Body $removeTask -ContentType "application/json"

Does someone face the same issue?

Best Regards
 

Hi @D4T4Pr0T3ction , thanks for the post!  I’, not aware of this issue, though it sounds like it is not working as expected.

Might be worth opening a support case to have this exact scenario looked at.


Hi @D4T4Pr0T3ction,

 

I had a support case a while back with a similar issue.  The problem here is that you are using the “removeTask” API call.  you should be using the Delete Schedule Policy entity instead:

 - https://documentation.commvault.com/11.24/essential/48876_rest_api_delete_schedule_policy_entity.html

 

To explain why, there is a difference from excluding a subclient association and simply just not selecting one.  In order to “Exclude” a subclient you would need to first select “all” at a parent level:
 

 

The difference of just not selecting a subclient is that only the specific subclients are selected and not “all” at the higher level:

 

 

Your API call of “removeTask” would be the same as “excluding” the subclient as described above. So in order to first be able to exclude a subclient, “ALL” would need to be selected at the next higher level (the backupset in this case).

So your call would be expected to exclude the one subclient in question but also select all the others in the process.

 

The Delete entity API call is the same as “un-checking” the subclient and apparently what you need.

 

Let me know if you have any questions on this.

 

Thanks


@JBuratti you’re totally correct, this was the function i desired.
$body = ‘subclientid=123’ 

Invoke-RestMethod "webconsole/webconsole/api/Task/$($CVSubClientSchedPolicy.task.taskID)/Entity" -Method Delete -Headers $headers -body $body

 

Many thanks!