Is it possible to automatically paginate when getting batch job results?

35 views
Skip to first unread message

xiaochuan li

unread,
May 15, 2025, 9:44:17 PM5/15/25
to Google Ads API and AdWords API Forum
When I use "ListBatchJobResultRequest", in some cases, it still returns an error that the maximum limit is exceeded. In this case, I can only keep adjusting the page_size. It is very inflexible. So is there a way to limit the maximum number of bytes per page instead of limiting the page_size?

log info:
-------
Method: /google.ads.googleads.v18.services.BatchJobService/ListBatchJobResults
Host: googleads.googleapis.com
Headers: {
  "developer-token": "REDACTED",
  "login-customer-id": "11111111111",
  "x-goog-api-client": "gl-python/3.10.4 grpc/1.68.0 gax/2.23.0 gccl/25.1.0 pb/5.29.0",
  "x-goog-request-params": "resource_name=customers/1111111/batchJobs/111111111"
}
Request: resource_name: "customers/1111111/batchJobs/111111"
page_size: 250
response_content_type: MUTABLE_RESOURCE


Response
-------
Headers: {}
Fault: {}

Request made: ClientCustomerId: 11111111, Host: googleads.googleapis.com, Method: /google.ads.googleads.v18.services.BatchJobService/ListBatchJobResults, RequestId: None, IsFault: True, FaultMessage: CLIENT: Received message larger than max (73353933 vs. 67108864)

Google Ads API Forum Advisor

unread,
May 16, 2025, 3:03:25 AM5/16/25
to clixia...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

From the provided information, I understand that you are experiencing the 'maximum limit is exceeded' error while executing the BatchJobService. According to the best practices of batch job service, I would suggest to follow the below guidelines:
  • Don't poll the job status too frequently or you risk hitting rate limit errors.
  • Don't retrieve more than 1,000 results per page. The server could return fewer than that due to load or other factors.
  • The results order will be the same as the upload order.
I could see that you are using the 'v18' of the Google Ads API which is already deprecated. I would recommend migrating to the latest version v19, please follow this guide to upgrade to the latest version. As per the pagination, if your account contains 50,000 keywords, the result set will contain 10,000 Google Ad Row objects in the first response, along with a next_page_token.

To retrieve the next 10,000 rows, send the request again, but update the request's page_token to the response's next_page_token. Note that next_page_token is not populated in the response that contains the last batch of rows. Our client libraries handle paging automatically. You only have to iterate through the rows of the response.

The page_size field was removed in v19 of the Google Ads API. See the announcement. The page_size field has a default value of 10,000. Don't attempt to set the page_size value, as that will throw an error.

If the issue still persists, could you please provide us with the updated complete API logs (request and response with request-id and request header) of where you are observing the maximum limit is exceeded error.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java, .Net, PHP, Python, Ruby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5
[2025-05-16 07:02:30Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01qXDuh:ref" (ADR-00306165)



Reply all
Reply to author
Forward
0 new messages