SelectorError.START_INDEX_IS_TOO_HIGH trigger:110000

599 views
Skip to first unread message

nakisa mohammadifard

unread,
Jul 30, 2014, 1:06:37 PM7/30/14
to adwor...@googlegroups.com
Hi,

I am trying to get all the keywords in an account and I am using paging for that. According to the limits of google, there can be 3 million keywords in an account though while I am trying to get them I get an error SelectorError.START_INDEX_IS_TOO_HIGH for start index of paging set to 110000. Is there any explanation and what should I do to get the remaining millions of keywords?

Thanks,
Nakisa 

Josh Radcliff (AdWords API Team)

unread,
Aug 1, 2014, 4:36:55 PM8/1/14
to adwor...@googlegroups.com
Hi Nakisa,

As mentioned in our System Limits doc, the highest start index allowed is 100,000. You can do a few things to work around this:

1. Use Structure Reports to fetch the keyword data. Reporting does not have the same limits as the SOAP services.
2. Instead of trying to retrieve all of the keywords in a single request, break up the requests by campaign or ad group.

Cheers,
Josh, AdWords API Team

Karim Benna

unread,
Mar 1, 2016, 8:39:14 AM3/1/16
to AdWords API Forum
I have the same problem but i wish to have a nicer solution than to change everything by using reports not services could anyone please help me ? 

int offset = 0;
SelectorBuilder builder = new SelectorBuilder();
Selector selector = builder
.fields(AdGroupAdField.CreativeFinalUrls, AdGroupAdField.AdGroupId)
.orderAscBy(AdGroupAdField.AdGroupId)
.offset(offset)
.limit(PAGE_SIZE)
.build();
do {
// Get all campaigns.
page = adService.get(selector);
int i = 0;
if (page.getEntries() != null) {
for (AdGroupAd campaign : page.getEntries()) {
try {
if (campaign.getStatus().getValue() == "ENABLED") {
ArrayList<String> inner = new ArrayList<String>();
inner.add(campaign.getAd().getFinalUrls()[0]);
inner.add(Long.toString(campaign.getAdGroupId()));
urls.add(inner);
i++;
}
} catch (NullPointerException e) {
System.out.println("A campaign of this GroupAd: " + campaign.getAdGroupId() + " is :"
+ campaign.getStatus());
}
}
} else {
System.out.println("No campaigns were found.");
}
offset += PAGE_SIZE;
selector = builder.increaseOffsetBy(PAGE_SIZE).build();
System.out.println("there is found: " + i + " Urls");
} while (offset < page.getTotalNumEntries());

Josh Radcliff (AdWords API Team)

unread,
Mar 1, 2016, 9:10:55 AM3/1/16
to AdWords API Forum
Hi,

Since your processing loop is ignoring any ad group whose status is not ENABLED, I'd recommend adding a predicate on Status = ENABLED when building your Selector. If you have a large number of PAUSED or REMOVED ad groups, the addition of that predicate will greatly reduce the total number of entries for your request.

Thanks,
Josh, AdWords API Team

Karim Benna

unread,
Mar 1, 2016, 9:22:03 AM3/1/16
to AdWords API Forum
The problem is that i have minimum 250000 active Ads so i need to find a way to avoid that limit do u think it's possible ? and how ? i'm sorry to ask again the same question but the solution you gave me doesn't really help for my case but i thank you anyway

Josh Radcliff (AdWords API Team)

unread,
Mar 1, 2016, 10:35:31 AM3/1/16
to AdWords API Forum
Hi,

In that case, you'll want to batch your requests by ad group ID. For example:
  1. Issue an AdGroupService.get to retrieve the list of all ENABLED ad groups and collect all of their IDs.
  2. Split the collection of ad group IDs into multiple collections, each with a reasonable max size. For example, if you have a maximum of 20 ads per ad group and 1,000 ad groups, then you'd create:
    • Batch 1 = ad group IDs 1 to 500 (maximum # of ads = 20 * 500 = 10,000)
    • Batch 2 = ad group IDs 501 to 1000
  3. For each collection of ad group IDs, issue an AdGroupAdService.get with a predicate on AdGroupId IN [collectionOfAdGroupIds].
  4. Combine results of all the iterations in step 3.
Cheers,
Josh, AdWords API Team

Karim Benna

unread,
Mar 1, 2016, 10:58:47 AM3/1/16
to AdWords API Forum
I thought about this solution but maybe it's nessessary that you know what i'm doing:

I'm writing a programm that is getting all the FinalUrls of all ads of different accounts (from different Acc IDs) so it has to be dynamic and the IDs changes always because we have a lot of accounts and dynamic ADs.

So you mean i can get all the AdGroup IDs and then loop throw them and get the Ads by AdGroup Ids did i understand it well ?

Thank you again

Josh Radcliff (AdWords API Team)

unread,
Mar 1, 2016, 1:45:36 PM3/1/16
to AdWords API Forum
Hi,

So you mean i can get all the AdGroup IDs and then loop throw them and get the Ads by AdGroup Ids did i understand it well ?

Yes, that's correct. You should use predicates to control how large your result set is (totalNumEntries) and thereby avoid exceeding the limits.

Thanks,
Josh, AdWords API Team
Reply all
Reply to author
Forward
0 new messages