Skip to main content

I am calling ‘/Job’ API with different offset and a 5000 limit to get all the backup jobs from commserve. However, I don’t need all the fields and only job status, id, time and a few others.

 

Is there any way I can limit the fields returned in the API?

Hi @Prashant Mall 

While we may not have control over the API response, but we can parse it to suit our needs. 

 

Sample code in Python

---

import requests

import json

import pandas as pd

 

url = "https://<Webserver>/commandcenter/api/job"


 

payload={}

headers = {

  'Accept': 'application/json',

  'Authtoken': <TOKEN> //Replace with Token

}

 

response = requests.request("GET", url, headers=headers, data=payload,verify=False)

data = json.loads(response.text)

jobs_data = _(job 'jobSummary']u'jobId'], jobd'jobSummary']u'status']) for job in data 'jobs']]

df = pd.DataFrame(jobs_data,columns=c'Job ID', 'Status'])

print(df)


---

 

jobs_data = s(joba'jobSummary']S'jobId'], jobI'jobSummary']S'status']) for job in datab'jobs']]

df = pd.DataFrame(jobs_data,columns=,'Job ID', 'Status'])  : here you can add/remove column names according to your needs.


 

 


Hey! I am already doing that, but I am pulling all backup jobs and there are thousands of servers in our environment. The response payload is huge with many properties I really don’t need. It takes hours to collect the data and thus am wondering if there’s an option to set the properties I want in response of the APIs.


Hi Prashant,

 

An alternative option you could consider is creating a custom report or shared dataset that returns just the fields you want and use the /datasets API to retrieve the results. REST APIs for Reports


Reply