我正在尝试获取产品信息,但出了点问题。有人知道到底出了什么问题吗?String query ="https://www.googleapis.com/androidpublisher/v3/applications/jksldf/purchases/products/kmdsd/tokens/kjls" HttpURLConnection connection; try { connection = (HttpURLConnection) new URL(query).openConnection(); connection.setRequestMethod("GET"); connection.setUseCaches(false); connection.connect(); if (HttpURLConnection.HTTP_OK == connection.getResponseCode()) { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String line; StringBuilder stringBuilder = new StringBuilder(); while ((line = bufferedReader.readLine()) != null) { stringBuilder.append(line); JSONArray ja = new JSONArray(stringBuilder); } } } catch (Throwable throwable) { throwable.printStackTrace(); } } }
1 回答
皈依舞
TA贡献1851条经验 获得超3个赞
当我将 url 粘贴到浏览器中时,我还会收到一条错误消息:
"code": 401, "message": "Login Required"
这意味着您将需要一个访问令牌才能使用他们的 API
添加回答
举报
0/150
提交
取消