Reputation: 27
I managed to use oauth2 to get a proper key to make my requests.
This is the endpoint I'm using:
https://www.googleapis.com/webmasters/v3/sites/<urlencoded version of website>/searchAnalytics/query
and I'm using this JSON code as the POST parameter (since I'm calling the API in curl).
{"startRow":0,"rowLimit":10,"dataState":"All","aggregationType":"byPage","startDate":"2023-10-21","endDate":"2024-10-22"}
I then format the return value with PHP and I get this:
Array
(
[rows] => Array
(
[0] => Array
(
[clicks] => 191
[impressions] => 9791
[ctr] => 0.019507711163313
[position] => 20.791747523236
)
)
[responseAggregationType] => byPage
)
I played around with the dates but everytime I only get one row returned.
Is there a way I can get this data for each URI. For example, is there a way I can get the above data for: http://example.com/page1 and http://example.com/page2 preferably using only one API call?
I specified larger date ranges for the query. The actual website in question has been up for longer than a year.
Upvotes: 0
Views: 11