Solved

POST Subclient Properties


Badge +4

I’m using subclient ID to add a VM to a subclient.  I can’t find and example for this.  Does this json template from here actually work?

 https://documentation.commvault.com/11.24/essential/49184_rest_api_post_subclient_properties.html

I keep getting 400 Bad Request

https://documentation.commvault.com/11.24/essential/assets/features/rest_api/JSON/update_subclient_vm_template.json

{    "newName": "",    "subClientProperties": {        "vmContent": {        },        "vsaSubclientProp": {            "useChangedTrackingOnVM": ,            "quiesceGuestFileSystemAndApplications": ,            "datastoreFreespaceCheck": ,            "datastoreFreespaceRequired": ,            "collectFileDetailsForSnap": ,            "collectFileDetails":         }    },    "association": {        "entity": [{            "clientName": "",            "subclientName": "",            "backupsetName": "",            "instanceName": "",            "appName": "Virtual Server"        }]    }}
icon

Best answer by Navneet Singh 19 July 2023, 09:23

View original

3 replies

Badge +4

Navneet Singh, thankyou this really helped, its working now

Userlevel 7
Badge +23

On bad request, you may find additional info in webserver.log when you execute the REST request as to why you are getting error 400.

Userlevel 3
Badge +10

@G2T 

400 error which means there is something wrong with the body information. You can use the below JSON body and try adding the VM to the Subclient.

 

{
    "subClientProperties": {
        "subClientEntity": {
            "clientName": "pcpctchvcen01.cloud.cris.in",
            "appName": "Virtual Server",
            "backupsetName": "XXXX",
            "subclientName": "test-3"
        },
        "vmContentOperationType": "ADD",
        "vmContent": {
            "children": [
                {
        "equalsOrNotEquals": true,
        "displayName": "XXXX",
        "allOrAnyChildren": true,
        "description": "",
        "type": "VM",
        "path": "XXXX",
        "name": "XXXXXX"
                }
            ]
        },
        "commonProperties": {
            "storageDevice": {
                "dataBackupStoragePolicy": {
                    "storagePolicyName": "XXXXX"
                }
            }
        }
    }
}

 

Also you can follow Api.commvault.com DOC page and look for the sample request and reponse.

Reply