I am using Business Profile Performance API to get the search keywords used to find a business in search or maps. Supposing business_profile_performance is the initializer variable of type BusinessProfilePerformance
API which also takes care of credentials:
try{
BusinessProfilePerformance.Locations.Searchkeywords.Impressions.Monthly.List impressionsList= business_profile_performance.
locations().searchkeywords().impressions().monthly().list("locations/"+locationName);
ListSearchKeywordImpressionsMonthlyResponse response = impressionsList.execute();
List<SearchKeywordCount> impressions = response.getSearchKeywordsCounts();
System.out.println("Size is "+ impressions.size());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
It gives me error :
{
"code" : 400,
"details" : [ {
"@type" : "type.googleapis.com/google.rpc.BadRequest"
} ],
"errors" : [ {
"domain" : "global",
"message" : "Request contains an invalid argument.",
"reason" : "badRequest"
} ],
"message" : "Request contains an invalid argument.",
"status" : "INVALID_ARGUMENT"
}
Any help would be appreciated. Thank you.
Ok I found the answer, I was not sending months range: