Does anyone know how I can send request to this API using Java? The link is
Business Profile Performance API but there is no code example. The code I tried is not correct:
supposing businessProfilePerformance is a variable of type BusinessProfilePerformance
to initialise global parameters via its Builder and also takes care of authorisation.
try {
BusinessProfilePerformance.Locations.GetDailyMetricsTimeSeries metricReport = businessProfilePerformance.locations()
.getDailyMetricsTimeSeries(locationName);
GetDailyMetricsTimeSeriesResponse response = metricReport.execute();
if (!response.isEmpty()) {
System.out.println("Response== " + response);
}
} catch (Exception e) {
System.out.println(e);
}
The error is
com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
"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"
}
Thanks
I found the answer. I put it here in case might serve at anyone: supposing that the variable business_profile_performance is the initialiser global parameters via its Builder and also takes care of authentication.
the variable dailyMetric can be one of the metrics written in the photo below: