Solved

Killing Job using REST Api with reason

  • 28 April 2023
  • 8 replies
  • 125 views

Badge +1

Hi!

Can I somehow set a reason when killing jobs using POST http://mycommcell.com/webconsole/api/Job/123456/action/kill request?

icon

Best answer by NikkyArt 1 May 2023, 03:12

View original

8 replies

Userlevel 5
Badge +16

Use qoperation execute.

 

https://documentation.commvault.com/v11/expert/45331_updating_job_using_command_line_interface.html

Userlevel 1
Badge +3

 just send POST request

http://WebConsoleHostName/webconsole/api/Job/{{jobId}}/action/kill

example POST request over use CURL for killing job

curl --location --request POST 'http://WebConsoleHostName/webconsole/api/Job/433/action/kill' \
--header 'Accept: application/json' \
--header 'Authtoken: QSDK token would be auto set after POST Login is called.' \
--data ''

 

Userlevel 1
Badge +3

additionals,

u can use POST request “MultiJob Operation” to set value “operationDescription” displayed in “Reason for job delay”

example

curl --location 'http://{hostname}}/webconsole/api/Jobs/MultiJobOperation' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authtoken: QSDK {token}} \
--data '{
"operationDescription": "Test Job KILL",
"message": " ALL_SELECTED_JOBS",
"jobOpReq": {
"operationType": "JOB_KILL",
"jobs": [
{
"jobId": {jobid}
}
]
}
}'

 

Userlevel 5
Badge +16

additionals,

u can use POST request “MultiJob Operation” to set value “operationDescription” displayed in “Reason for job delay”

example

curl --location 'http://{hostname}}/webconsole/api/Jobs/MultiJobOperation' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authtoken: QSDK {token}} \
--data '{
"operationDescription": "Test Job KILL",
"message": " ALL_SELECTED_JOBS",
"jobOpReq": {
"operationType": "JOB_KILL",
"jobs": [
{
"jobId": {jobid}
}
]
}
}'

 

FYI Looks like this is identical to the qoperation request.

The XML in the qoperation is identical to 

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

The Json in the /MultiJoboperation api

{
"operationDescription": "Test Job KILL",
"message": " ALL_SELECTED_JOBS",
"jobOpReq": {
"operationType": "JOB_KILL",
"jobs": [
{
"jobId": ""
}
]
}
}

 

So the api is identical to the operation identifier “JobManager_PerformMultiCellJobOpReq”

 

It would be cool to get a map between the two.

Userlevel 1
Badge +3

additionals,

u can use POST request “MultiJob Operation” to set value “operationDescription” displayed in “Reason for job delay”

example

curl --location 'http://{hostname}}/webconsole/api/Jobs/MultiJobOperation' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authtoken: QSDK {token}} \
--data '{
"operationDescription": "Test Job KILL",
"message": " ALL_SELECTED_JOBS",
"jobOpReq": {
"operationType": "JOB_KILL",
"jobs": [
{
"jobId": {jobid}
}
]
}
}'

 

FYI Looks like this is identical to the qoperation request.

The XML in the qoperation is identical to 

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

The Json in the /MultiJoboperation api

{
"operationDescription": "Test Job KILL",
"message": " ALL_SELECTED_JOBS",
"jobOpReq": {
"operationType": "JOB_KILL",
"jobs": [
{
"jobId": ""
}
]
}
}

 

So the api is identical to the operation identifier “JobManager_PerformMultiCellJobOpReq”

 

It would be cool to get a map between the two.

 

yes, they are identical, but the question was about POST request via API ;)

Userlevel 5
Badge +16

The question was already answered. 
This was an observation on an implicit question.

The question being since api endpoints may or may not be defined for operation how does one determine if one already exists? 

And also if it doesn’t exist how do you accomplish unknown actions?

 

Not to worry. 
I will elaborate in a seperate post.

Userlevel 5
Badge +16

additionals,

u can use POST request “MultiJob Operation” to set value “operationDescription” displayed in “Reason for job delay”

example

curl --location 'http://{hostname}}/webconsole/api/Jobs/MultiJobOperation' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authtoken: QSDK {token}} \
--data '{
"operationDescription": "Test Job KILL",
"message": " ALL_SELECTED_JOBS",
"jobOpReq": {
"operationType": "JOB_KILL",
"jobs": [
{
"jobId": {jobid}
}
]
}
}'

 

FYI Looks like this is identical to the qoperation request.

The XML in the qoperation is identical to 

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

The Json in the /MultiJoboperation api

{
"operationDescription": "Test Job KILL",
"message": " ALL_SELECTED_JOBS",
"jobOpReq": {
"operationType": "JOB_KILL",
"jobs": [
{
"jobId": ""
}
]
}
}

 

So the api is identical to the operation identifier “JobManager_PerformMultiCellJobOpReq”

 

It would be cool to get a map between the two.

 

yes, they are identical, but the question was about POST request via API ;)

How did you find this api?

It’s not in Bol

Userlevel 1
Badge +3

additionals,

u can use POST request “MultiJob Operation” to set value “operationDescription” displayed in “Reason for job delay”

example

curl --location 'http://{hostname}}/webconsole/api/Jobs/MultiJobOperation' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authtoken: QSDK {token}} \
--data '{
"operationDescription": "Test Job KILL",
"message": " ALL_SELECTED_JOBS",
"jobOpReq": {
"operationType": "JOB_KILL",
"jobs": [
{
"jobId": {jobid}
}
]
}
}'

 

FYI Looks like this is identical to the qoperation request.

The XML in the qoperation is identical to 

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

The Json in the /MultiJoboperation api

{
"operationDescription": "Test Job KILL",
"message": " ALL_SELECTED_JOBS",
"jobOpReq": {
"operationType": "JOB_KILL",
"jobs": [
{
"jobId": ""
}
]
}
}

 

So the api is identical to the operation identifier “JobManager_PerformMultiCellJobOpReq”

 

It would be cool to get a map between the two.

 

yes, they are identical, but the question was about POST request via API ;)

How did you find this api?

It’s not in Bol


i have read the documentation - https://api.commvault.com

Reply