Skip to main content

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": t{            "clientName": "",            "subclientName": "",            "backupsetName": "",            "instanceName": "",            "appName": "Virtual Server"        }]    }}

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.


@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.


Navneet Singh, thankyou this really helped, its working now


Reply