Using the qoperation rest api endpoint to do (almost) anything you can do in the Gui

Userlevel 5
Badge +16

Who is this for?

This is written specifically for people who cannot find a way to do something in the rest API. 

When should I use the qoperation execute api?

If an API endpoint exists to do what you need use that, The rest api is much… much… much newer than qoperation execute and I suspect the thing that makes the rest api viable at all as a substitution for the command line is that fact that the qoperation execute api exists In other words it may be a stopgap solution. 



I am no expert, everything stated below is my opinion based on experience and experimentation.

With that said I  both welcome and invite criticism from those who have deeper insight and knowledge. 

This post is made solely to help those who are currently looking for solutions.

In order to be fair to the people reading this any pure speculation on my part will be placed in italics. 

That said I am quite confident that everything stated below is basically correct if not complete in scope and context. Anyone who can fill in the gaps of my knowledge will have earned my respect and gratitude.



On with the show.

One of the major problems with the rest api is that it is not exhaustive. Meaning there are probably a thousand things that are trivial to do in the gui that do not have a api endpoint equivalent. In fact you could argue that the task of making all the gui options available is both pointless and impractical. 


The good news is that  qoperation execute can in fact achieve all of the things you can do in the gui.

And by all of things the I mean making changes.. think POST or PUT not GET.


So where do we begin? First it’s instructive to look at how the rest api operates.

The diagram below gives us some valuable clues


Webconsole requests are processed by the web-server and routed to the Commserve for execution. Requests to the Commserve are embedded in XML tags and processed according to these tags. For example when you do a multi job operation in the Gui the following XML template is populated with your gui selection and sent to the Commserve

<?xml version='1.0' encoding='UTF-8'?>
<JobManager_PerformMultiCellJobOpReq message="" operationDescription="">
<jobOpReq operationType="">
<jobs jobId="" />
<jobs jobId="" />

This is true for every operation done in the gui a request is sent to the Commserve from processing via an xml submission. 

Now let’s look at qoperation execute


Qoperations have been around forever as the basic command line tools for interfacing with Commvault

Qoperation execute specifically exists to submit xml requests to the Commserve.



So our gui requests are submitted to the Commserve via xml

and Qoperation execute can send  xml to the commserve.




So now the only question now is how do we capture xml submitted to the commserve. Well there are two ways. 

  1. Most of the things that you can do in the gui can be captured using the save as script functionality. The resulting xml can then be used in conjunction with qoperation execute. Qoperation execute also has a rest api equivalent.
  2. The remainder can be captured through the Gui or alternatively at the commserve. I cannot share these methods as they are not public and I suspect there are reasons for that. That said if you are sufficiently enterprising you can probably figure it out. 

So now that this has been said here is some uncalled for speculation

  1. Most the qcommands that are not qoperation execute are actually a wrapper for qoperation execute with hidden xml elements being populated for you. It exists either because the xml was too complex for how often it needed to be used or because end users cannot be trusted with some parts of the xml.
  2. Most the rest api endpoints are just wrappers for qoperation execute. 


I hope that helps anyone who is unable to find a way to do something via the rest api.




0 replies

Be the first to reply!