我正在使用Google Analytics Management API进行过滤器更新。我一直在尝试使用此method来更新我的过滤器,但显然它不起作用。
以下是我的更新代码片段:
private static void updateFilter(Analytics analytics, String accountID) {
FilterExpression details = new FilterExpression();
details.setField("GEO_DOMAIN");
details.setMatchType("EQUAL");
details.setExpressionValue(".example.com");
details.setCaseSensitive(false);
// Construct the body of the request.
Filter body = new Filter();
body.setName("My Domain Filter");
body.setType("EXCLUDE");
body.setExcludeDetails(details);
try {
analytics.management().filters().update("<valid GA ID>", "<valid filter ID>", body).execute();
} catch (GoogleJsonResponseException e) {
System.err.println("There was a service error: "
+ e.getDetails().getCode() + " : "
+ e.getDetails().getMessage());
} catch (IOException ioEx) {
ioEx.printStackTrace();
}
我得到的错误代码是400:需要字段ID。据我所知,过滤器所需的一切都已在方法中初始化。我不知道&#34;字段ID是否必需&#34;应该是指。
感谢您提供的任何帮助。