Skip to main content
Solved

API for mssql db clone

  • 17 November 2022
  • 2 replies
  • 84 views

Hello Community 

 

Issue: 

I’m trying to schedule mssql db clone via Command center, and there is no such option.

Looking to clone db via CV API or Sending QCommands as a API Json request 

 

Tried:

While manually creating mssql db clone via command/admin center, noticed there is a Json Post Request Payload for instance clone.  Search in CV BOL, and nothing but how to View DB Clone via .py script

https://documentation.commvault.com/11.24/essential/45532_samples_for_developer_sdk_for_python.html#viewing-instant-clones

 

 

Questions:


the db clone has a payload request, from where I can find the related Post Request Syntax (example:  'http://<webserver>:port/SearchSvc/CVWebService.svc/databases/Action_XXX/clones_XXX') for mssql DB clone, thanks

 

Or

Sending QCommands as a API Json request 
 

CV Syntax example is for XML and I want to make it work for Json.

Can I use ‘inputRequestJson’ to get Json Request Payload that shows in above screenshot?
 

https://documentation.commvault.com/2022e/essential/48618_rest_api_post_execute_qcommand.html

 

2 replies

Userlevel 7
Badge +17

Hi @DanC 

The json method for QCommand via REST is described here:

https://api.commvault.com/#abade427-7892-4ea4-b6de-5c15b97241c8

Example request:

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" $headers.Add("Accept", "application/json") $headers.Add("Authtoken", "QSDK token would be auto set after POST Login is called.") $headers.Add("Content-Type", "application/x-www-form-urlencoded") $body = "command=qoperation%20execute&inputRequestXML=%3CTMMsg_InstallPackageListReq%20includeOnlyInstalledPackages%3D%221%22%20installOSType%3D%22100%22%20requestForUninstall%3D%221%22%3E%3CclientEntity%20clientId%3D%222%22%2F%3E%3C%2FTMMsg_InstallPackageListReq%3E" $response = Invoke-RestMethod 'http://WebConsoleHostName/webconsole/api/ExecuteQCommand' -Method 'POST' -Headers $headers -Body $body $response | ConvertTo-Json

 

Hope this helps.

Userlevel 3
Badge +13

@Jos Meijer  thank you

 

the example only for XML input (inputRequestXML)

 

 

I want to use JSON request payload via QCommand and How to put JSON input request to qoperation?  something like inputRequestJSON instead of inputRequestXML but I can’t find anything

 

Reply