cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

API Call to return more than 100 jobs

dpc
Contributor

Hello

 

I have around 150 jobs and this is likely to increase.

I use this call to get all the jobs and write them into a list called json.

My logic here is to match a name to a job id and run the job using the job id.

 

response = requests.get(hostHTTPS, json = additional_parameters, headers=auth).json()
 
HostHTTPS is basically this:
hostHTTPS = ''.join([databricksHost, "/api/2.1/jobs/list?limit=100"])
 
That goes off and returns 100 jobs - all good
 
If I change limit to more than 100, I get (e.g. 200):
 
{'error_code': 'INVALID_PARAMETER_VALUE', 'message': 'Invalid limit 200 - it has to be no more than 100.', 'details': [{'@type': 'type.googleapis.com/google.rpc.RequestInfo'
 
How do I increase this as 100 is a pretty small number?
 
Thanks
 
1 ACCEPTED SOLUTION

Accepted Solutions

bianca_unifeye
New Contributor III

Please refer to https://docs.databricks.com/api/workspace/jobs/list?

The official documentation for the Jobs API (GET /api/2.2/jobs/list) states that the limit parameter controls how many jobs are returned per call, and the API enforces a cap (100).

Because you have ~150 jobs and may have more later, you should loop over subsequent pages until you've retrieved all jobs. The API supports pagination: the response will include a next_page_token (or an equivalent mechanism) when there are more jobs to fetch.

https://docs.databricks.com/aws/en/reference/jobs-api-2-2-updates

View solution in original post

2 REPLIES 2

bianca_unifeye
New Contributor III

Please refer to https://docs.databricks.com/api/workspace/jobs/list?

The official documentation for the Jobs API (GET /api/2.2/jobs/list) states that the limit parameter controls how many jobs are returned per call, and the API enforces a cap (100).

Because you have ~150 jobs and may have more later, you should loop over subsequent pages until you've retrieved all jobs. The API supports pagination: the response will include a next_page_token (or an equivalent mechanism) when there are more jobs to fetch.

https://docs.databricks.com/aws/en/reference/jobs-api-2-2-updates

dpc
Contributor

Thanks. I will try that

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now