Reputation: 83
I'am trying to use google search console api to get some data out of my website. Below my code used to do that:à
service = build('webmasters', 'v3', http=http)
collection = service.searchanalytics()
request = {
'startDate': '2015-10-24',
'endDate': '2015-10-25',
'dimensions': ['query','page', 'device'],
'searchType': 'web',
'rowLimit': '5000'
}
response = collection.query(siteUrl=property_uri, body=request).execute()
My problem is that I'am only able to about 1000 row. I was wondering if there was a way to get all my website data. For example send another request to get the 1000 next row and so on. Right now, if I repeat the request I get the same response.
Thanks for your help
Upvotes: 0
Views: 1849
Reputation: 80
You can set the startRow Parameter to get more results. If the returned result has the length of the rowLimit, i add the rowLimit to the startRow.
Lets say i have 13000 query's on one day. So my startRow is 0 and my rowLimit is 5000.
In the first request i get 5000 results back. I check if results length = rowLimit. If yes i set my startRow = startRow + rowLimit.
In the second request i get 5000 results. I check if results length = rowLimit. If yes i set my startRow = startRow + rowLimit.
startRow is now 10000. In the third request i get 3000 results. Now my result lenght is not the rowLimit. I must have all data from google.
Upvotes: 0
Reputation: 303
As the documentation states: the valid range of rows is 1 to 5000 and "The API does not support paged results" (as opposed to the previous version of the then-called Webmaster Tools API).
So you are limited to a maximum of 5000 data rows (at least that's more than the 1000 lines that the browser interface will give you).
The effective number of rows also seems to vary, depending on filter and aggregation settings.
EDIT: Support for paged results has arrived lately, as it seems. There's now a parameter named "startRow" that has not been there before and it works as expected.
Upvotes: 1