Parameter applicationName must conform to the pattern (Google Report API)

不打扰是莪最后的温柔 提交于 2020-05-31 16:39:58

问题


I neet to get the google hangouts meet data by java code and I am trying the google report api

the following is my code

String userKey = "all";
String applicationName = "meet";
String eventName = "call_ended";
Activities result = service.activities().list(userKey, applicationName).setEventName(eventName).setMaxResults(10).execute();

and the response is

Parameter applicationName must conform to the pattern (admin)|(calendar)|(drive)|(login)|(token)

the api I am trying is this, i can get the data in this link by the same parameters

https://developers.google.com/admin-sdk/reports/v1/reference/activities/list

and I also can get the data by the following java code

public static String getGraph() {
        String PROTECTED_RESOURCE_URL = "https://www.googleapis.com/admin/reports/v1/activity/users/all/applications/meet?eventName=call_ended&maxResults=10&access_token=";
        String graph = "";
        try {
            URL urUserInfo = new URL(PROTECTED_RESOURCE_URL + "access_token");
            HttpURLConnection connObtainUserInfo = (HttpURLConnection) urUserInfo.openConnection();
            if (connObtainUserInfo.getResponseCode() == HttpURLConnection.HTTP_OK) {
                StringBuilder sbLines = new StringBuilder("");

                BufferedReader reader = new BufferedReader(
                        new InputStreamReader(connObtainUserInfo.getInputStream(), "utf-8"));
                String strLine = "";
                while ((strLine = reader.readLine()) != null) {
                    sbLines.append(strLine);
                }
                graph = sbLines.toString();
            }
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        return graph;
    }

I think it's not a good solution and what i got is a complex string

Any solution please!?


回答1:


This is a known bug already referenced on Google Issue Tracker; you can check it here.



来源:https://stackoverflow.com/questions/61180352/parameter-applicationname-must-conform-to-the-pattern-google-report-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!