我已經得到了如下的錯誤com.google.api.client.googleapis.json.GoogleJsonResponseException:400錯誤的請求
com.google.api.client.googleapis.json.GoogleJsonResponseException:400錯誤的請求 { 「代碼」:400, 「錯誤」:[{ 「結構域」: 「全局」, 「消息」: 「選擇的維度和度量不能一起查詢。」, 「原因」: 「錯誤請求」 }], 「消息」:「選定的維度和指標不能一起查詢。」
指標均低於: 「GA:uniquePurchases,GA:itemRevenue,GA:transactionTax,GA:transactionShipping下面
尺寸: 「GA:產品名稱」;
if (accessToken != null && refreshToken != null) {
JacksonFactory jacksonFactory = new JacksonFactory();
GoogleCredential credential =new GoogleCredential.Builder().setTransport(netHttpTransport)
.setJsonFactory(jacksonFactory).setClientSecrets(CLIENT_ID, CLIENT_SECRET).build();
credential.setAccessToken(accessToken);
credential.setRefreshToken(refreshToken);
analytics=new Analytics.Builder(netHttpTransport, jacksonFactory, credential).setApplicationName(APPLICATION_NAME).build();
try {
//AT a time we can get only 7 dimensions and 10 metrics
apiQuery = analytics.data().ga().get("ga:" + gleTokenInf.getProfileId(), TimeStamp1, TimeStamp2,getMetrics());
apiQuery.setDimensions(getDimensions());
gaData = apiQuery.execute();
log.info("Succesfully got the data for GA MOM Report from Analytics Interface ");
} catch (Exception ex) {
ex.printStackTrace();
}
}
可能出現[Google AnalyticsAPI錯誤「無法一起查詢所選維度和指標」的重複。](http://stackoverflow.com/questions/29152101/google-analytics-api-error-selected-dimensions-and -metrics-can-be-queried-to) – DaImTo