REST API - POST QCommand

Commvault REST APIs support sending QCommands as a request.

Note

databrowse XML files cannot be run by using POST /QCommand. To browse data, use the POST Browse API.

Request

Important: To determine whether to use syntax I, syntax II, or the POST ExecuteQCommand API, see QCommand REST APIs.

Syntax I

POST <webservice>/QCommand/<qcommand> <applicable parameters> HTTP/1.1 Host: <host name> Accept: application/xml Authtoken: <authentication token>Content-type: application/xml <XML if required by the qcommand>

where <webservice> is the root path used to route the API requests to the Web Server.

For more information, see Available Web Services for REST API.

Request Parameters

If the QCommand takes parameters, send the parameters as a request parameter:

  • QCommand/qlist client

  • QCommand/qoperation checkready -h

  • QCommand/qoperation execscript -sn DataProtectionJobSummary -si @LastNDays = '7'

Syntax II

POST <webservice>/QCommand HTTP/1.1 Host: <host name> Accept: application/xml Authtoken: <authentication token> Content-type: text/plain <qcommand> <applicable parameters>

where <webservice> is the root path used to route the API requests to the Web Server.

For more information, see Available Web Services for REST API.

Request Headers

Name

Description

Host

The host name of the Web Server or Web Console used in the API request.

Accept

The format of the response. Valid values are: application/xml or application/json.

Authtoken

The authentication token received after successfully logging on. For details on receiving an authentication token, see Authentication.

Content-type

The media type contained in the request body. This is required in the following situations:

  • If XML is required in the request body (for example, qoperation execute) use application/xml as the content-type

  • If you send the QCommand and the parameters in the request body (Syntax II), use text/plain as the content-type

Request Body

If the QCommand requires XML in the request body, download the XML file required for the request, for example, modifying additional setting details for one or more clients requires the additional_settings.xml file.

Response

The response depends on the QCommand request.

Examples

qlist Example

Sample Requests: qlist client

For information on qlist client, see Command Line Interface - CommServe QCommands - qlist client.

POST <webservice>/QCommand/qlist client HTTP/1.1
Host: client.mydomain.com
Accept: application/xml
Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6
0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f
8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f
40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7
68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323
3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8
POST <webservice>/QCommand HTTP/1.1
Host: client.mydomain.com
Accept: application/xml
Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6
0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f
8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f
40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7
68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323
3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8
Content-type: text/plain
qlist client

Sample Response: qlist client

NAME OS ACTIVE 
 ---- -- ------ 
 client0001 Windows Yes 
 client0002 Windows Server 2008 Yes 
 desktop Windows Yes 
 docanu Windows Yes 
 reffall Reference Copy Client Yes 
 proxy Windows95 No 
 dept001 Unix No 
 vm_vcenter Any Yes 
 vmclient Windows Yes

qoperation Example

Sample Requests: qoperation checkready

For information on the parameters available for qoperation checkready, see Command Line Interface - CommServe QCommands - qoperation checkready.

POST <webservice>/QCommand/qoperation checkready -h HTTP/1.1
Host: client.mydomain.com
Accept: application/xml
Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6
0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f
8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f
40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7
68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323
3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8
POST <webservice>/QCommand HTTP/1.1
Host: client.mydomain.com
Accept: application/xml
Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6
0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f
8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f
40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7
68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323
3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8
Content-type: text/plain
qoperation checkready -h

Sample Response: qoperation checkready

Gives report of the readiness of the client
Usage: checkready [-cs commserver] -c client [-sm summary] [-dt detail] [-tf tokenfile] [-tk token] [-h]
Options:
-cs Commserver host name
-c Client computer name
-sm Displays summary of check readiness
-dt Displays detailed report on check readiness
-tf Reads token from a file
-tk Token string
-h Displays help

qoperation execute Example

Sample Request: Enabling Privacy at the CommCell Level

For information on enabling privacy at the CommCell level, see Command Line Interface - User Administration and Security - Enabling Privacy at the CommCell Level.

POST <webservice>/QCommand/qoperation execute HTTP/1.1
Host: client.mydomain.com
Accept: application/xml
Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6
0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f
8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f
40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7
68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323
3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8
Content-type: application/xml
<App_SetControlPanelParametersRequest>
  <preventAdminAccessToUserData>true</preventAdminAccessToUserData>
</App_SetControlPanelParametersRequest>

Sample Response: Enabling Privacy at the CommCell Level

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<App_GenericResponse>
  <response errorCode="0" warningCode="0" warningMessage=""/>
</App_GenericResponse>

qoperation execscript Example

Sample Requests: DataProtectionJobSummary

For information on the parameters available for DataProtectionJobSummary, see Command Line Operations Using QScripts.

POST <webservice>/QCommand/qoperation execscript -sn DataProtectionJobSummary -si @LastNDays = '2'HTTP/1.1
Host: client.mydomain.com
Accept: application/xml
Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6
0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f
8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f
40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7
68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323
3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8
POST <webservice>/QCommand HTTP/1.1
Host: client.mydomain.com
Accept: application/xml
Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6
0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f
8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f
40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7
68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323
3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8
Content-type: text/plain
qoperation execscript -sn DataProtectionJobSummary -si @LastNDays = '2'

Sample Response: DataProtectionJobSummary

<?xml version="1.0" encoding="UTF-8" standalone="no" ?><ExecScriptOutput><FieldValue Agent="Windows File System" Application_Size__GB_=".008" Backupset="defaultBackupSet" Client="summer" Client_Group="Media Agents : lbs_group : test" Compression_Rate____="99.42" Data_Size_Change____="0" Data_Transferred__GB_=".000" Data_Written__GB_=".000" End_Date="07/13/2014" End_Time="16:03:57" Failed_Folders="0" Failed_Objects="0" Failure_Code="" Failure_Reason="" Instance="DefaultInstanceName" Job_Id="3939" Job_Status="Completed with errors" Job_Type="Full" Operation="Backup" Protected_Objects="10" Scan_Type="N/A" Space_Saving____="98.67" Start_Date="07/13/2014" Start_Time="16:00:13" Storage_Policy="LBS_Storage_Policy_0" Subclient="DDBBackup" Throughput__GB_Hour_="1.223" Transfer_Time="00:00:23" VM="N/A" VM_Failure_Reason="N/A" VM_Status="N/A"/><FieldValue Agent="Windows File System" Application_Size__GB_=".008" Backupset="defaultBackupSet" Client="summer" Client_Group="Media Agents : lbs_group : test" Compression_Rate____="99.42" Data_Size_Change____="0" Data_Transferred__GB_=".000" Data_Written__GB_=".000" End_Date="07/13/2014" End_Time="08:02:45" Failed_Folders="0" Failed_Objects="0" Failure_Code="" Failure_Reason="" Instance="DefaultInstanceName" Job_Id="3936" Job_Status="Completed with errors" Job_Type="Full" Operation="Backup" Protected_Objects="10" Scan_Type="N/A" Space_Saving____="98.67" Start_Date="07/13/2014" Start_Time="08:00:11" Storage_Policy="LBS_Storage_Policy_0" Subclient="DDBBackup" Throughput__GB_Hour_="1.407" Transfer_Time="00:00:20" VM="N/A" VM_Failure_Reason="N/A" VM_Status="N/A"/><FieldValue Agent="Windows File System" Application_Size__GB_=".008" Backupset="defaultBackupSet" Client="summer" Client_Group="Media Agents : lbs_group : test" Compression_Rate____="99.42" Data_Size_Change____="0" Data_Transferred__GB_=".000" Data_Written__GB_=".000" End_Date="07/13/2014" End_Time="00:03:58" Failed_Folders="0" Failed_Objects="0" Failure_Code="" Failure_Reason="" Instance="DefaultInstanceName" Job_Id="3924" Job_Status="Completed with errors" Job_Type="Full" Operation="Backup" Protected_Objects="10" Scan_Type="N/A" Space_Saving____="98.67" Start_Date="07/13/2014" Start_Time="00:00:13" Storage_Policy="LBS_Storage_Policy_0" Subclient="DDBBackup" Throughput__GB_Hour_="1.279" Transfer_Time="00:00:22" VM="N/A" VM_Failure_Reason="N/A" VM_Status="N/A"/></ExecScriptOutput>

Loading...