Skip to main content

Can anyone share the REST API call to update subclient content of virtual sever sub-client  ?

Also what does this error means - FuncnaddVMToSubClient] Linen629]: status=401 content=u'<Api_GenericResp errorMessage="Access denied" errorCode="5" />'
INFO:api.v1.services:status=401 content=u'<Api_GenericResp errorMessage="Access denied" errorCode="5" />'

@Mohit Chordia 401 error code means that the token being used to make these API calls is invalid or has expired.


@psingh :

I am able to successfully login in to commserve but facing an error when trying to update subclient content., not sure how to resolve this and what is the root cause of this issue.

2021-02-09 10:08:51,446 INFO Source[/root/BackupAPI/api/v1/services.py] Moduleeservices] FunccgetToken] Linee246]: http://xxxxx.corp.adobe.com:81/SearchSvc/CVWebService.svc/Login

INFO:api.v1.services:status=200 content=u'<DM2ContentIndexing_CheckCredentialResp aliasName="1019" userGUID="C8ACCD1B-F59C-4A73-9C67-FFC510667DB4" loginAttempts="0" remainingLockTime="0" " userName="xxxxx" providerType="1" ccn="0" 

 

 

2021-02-09 10:08:53,283 INFO Source[/root/BackupAPI/api/v1/services.py] Moduledservices] FuncFaddVMToSubClient] LineL622]: url=http://xxxxxx.corp.adobe.com:81/SearchSvc/CVWebService.svc/Subclient/5948,params=u'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<App_UpdateSubClientPropertiesRequest>\n\t<association>\n\t\t<entity>\n\t\t\t<appName>Virtual Server</appName>\n\t\t\t<instanceName>VMware</instanceName>\n\t\t\t<backupsetName>xxxx</backupsetName>\n\t\t\t<clientName>xxxxxx</clientName>\n\t\t\t<subclientName>xxxx</subclientName>\n\t\t</entity>\n\t</association>\n\t<subClientProperties>\n\t    <vmContentOperationType>ADD</vmContentOperationType>\n\t    <vmContent><children equalsOrNotEquals="1" name="" displayName="xxxxxx*" type="VMName"/></vmContent>\n\t</subClientProperties>\n</App_UpdateSubClientPropertiesRequest>\n\n'
INFO:api.v1.services:url=http://xxxxx.corp.adobe.com:81/SearchSvc/CVWebService.svc/Subclient/5948,params=u'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<App_UpdateSubClientPropertiesRequest>\n\t<association>\n\t\t<entity>\n\t\t\t<appName>Virtual Server</appName>\n\t\t\t<instanceName>VMware</instanceName>\n\t\t\t<backupsetName>xxxxxx</backupsetName>\n\t\t\t<clientName>xxxxx</clientName>\n\t\t\t<subclientName>xxxxx</subclientName>\n\t\t</entity>\n\t</association>\n\t<subClientProperties>\n\t    <vmContentOperationType>ADD</vmContentOperationType>\n\t    <vmContent><children equalsOrNotEquals="1" name="" displayName="xxxxx" type="VMName"/></vmContent>\n\t</subClientProperties>\n</App_UpdateSubClientPropertiesRequest>\n\n'
2021-02-09 10:08:53,302 INFO Source[/root/BackupAPI/api/v1/services.py] Modulesservices] FuncraddVMToSubClient] LineC629]: status=401 content=u'<Api_GenericResp errorMessage="Access denied" errorCode="5" />'
INFO:api.v1.services:status=401 content=u'<Api_GenericResp errorMessage="Access denied" errorCode="5" />'


@Mohit Chordia  what permissions do you have on the VM group? 


@psingh 

The account which I am using for API call, using the same account I can log in into commcell console and update subclient content ( add and remove ) successfully.

Also, I have added the user account to the master group so I believe permission is not an issue here.

I also tried to run the automation through cvadmin account but still seeing the same error.


@Mohit Chordia Thank you! I’ll try and involve another colleague who can check more details.


Get your auth token

Get the subclient id running the command: https://commserve/webconsole/api/Subclient?clientID=2665

Change your method to “PUT” and change the request URL to /Subclient/{subclientid}/content

Get the request body from https://documentation.commvault.com/11.21/assets/products/vs_vmware/command_line_xml/update_subclient_vm_template.xml

Paste the XML and make sure you filled out the vmcontentoperation type, in my case “overwrite” and the “children” details:

It should look like this.

 

If you submit it correctly, it should update the subclient/vm group.

 

 


@MFasulo

We are using the POST method to ADD VMs to the virtual server subclient. It was working fine earlier but suddenly started giving “access denied error” 401. I am using operation type as ADD as I don't want to overwrite existing content. Also we are not using webconsole URL but below mentioned one -

Request 

POST http://<commserver>.corp.adobe.com:81/SearchSvc/CVWebService.svc/Subclient/7429

XML:

<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<App_UpdateSubClientPropertiesRequest>\n\t<association>\n\t\t<entity>\n\t\t\t<appName>Virtual Server</appName>\n\t\t\t<instanceName>VMware</instanceName>\n\t\t\t<backupsetName>XXXXXX</backupsetName>\n\t\t\t<clientName>XXXXXX</clientName>\n\t\t\t<subclientName>rest_or1_vm008</subclientName>\n\t\t</entity>\n\t</association>\n\t<subClientProperties>\n\t    <vmContentOperationType>ADD</vmContentOperationType>\n\t    <vmContent><children equalsOrNotEquals="1" name="" displayName="x*" type="VMName"/></vmContent>\n\t</subClientProperties>\n</App_UpdateSubClientPropertiesRequest>\n\n

 

Error -

Source[/root/BackupAPI/api/v1/services.py] Moduleeservices] FuncfaddVMToSubClient] Lineb629]: status=401 content=u'<Api_GenericResp errorMessage="Access denied" errorCode="5" />'


That worked for me:

 

<?xml version="1.0" encoding="UTF-8"?>
<App_UpdateSubClientPropertiesRequest>
<association>
<entity>
<appName>Virtual Server</appName>
<instanceName />
<backupsetName />
<clientName />
<subclientName />
</entity>
</association>
<newName />
<subClientProperties>
<vsaSubclientProp>
<datastoreFreespaceCheck />
<datastoreFreespaceRequired />
<collectFileDetailsForSnap />
<collectFileDetails />
<quiesceGuestFileSystemAndApplications />
<useChangedTrackingOnVM />
</vsaSubclientProp>
<vmContentOperationType>ADD</vmContentOperationType>
<vmContent>
<children equalsOrNotEquals="1" displayName="testtoseeme5" type="VMName" />
</vmContent>
</subClientProperties>
</App_UpdateSubClientPropertiesRequest>

 


@MFasulo 

Thanks for the reply. Which account are you using for the API calls?

Is there any special permission that needs to be assigned to the user?


@MFasulo

Thanks for the reply. Which account are you using for the API calls?

Is there any special permission that needs to be assigned to the user?

Almost full admin

 

Do me a favor, go into command center type “roles” into the entity search bar.  There should be a hit for manage > security > roles.   Open the role that is assigned to your user having the issue.  At the bottom of that window (hopefully you are on the latest release) there should be a button/link that says “Equivalent API”.  Download the JSON file and email it to me at “bro@commvault.com”  I’ll create a user with that role and see why your having this issue.


@MFasulo My Commserve Version is 11.20.32.

I don't see any button/link that says “Equivalent  API”, However, I can email you snapshots.

Also which tool are you using for API testing? 

Is there any change in the API version, How can I validate which API version I am using?

 

Regards, Mohit

 


for my apis, I normally use a read only account but if you want to make changes you might have to modify the account and give it enough rights.


Reply