我如何通过Android上的API键接收Push之中的笔记/图像/配置文件细节?我的主要问题是这一点上的SSL安全性。(顺便说一句:我几乎是Android的初学者,只懂基本知识。)
奥斯看起来是这样的:
https://apikey@api.pushbullet.com/v2/users/me我正在通过以下途径成功地请求网页的内容(例如wikipedia.org)
try {
URL url = new URL("https://www.wikipedia.org");
URLConnection urlConnection = url.openConnection();
InputStream in = urlConnection.getInputStream();
StringWriter writer = new StringWriter();
IOUtils.copy(in, writer);
theString = writer.toString();
textView.setText(theString);
} catch (Exception e) {
textView.setText("Error: "+e "String content: " +theString);
}但是当我要求的时候,例如,我的个人资料,我总是得到一个
javaio FileNotFoundException
发布于 2015-04-09 21:00:58
如果您通过https://www.runscope.com运行请求,您通常可以看到客户端实际提出的请求(他们有一个免费的尝试计划)。
如果我不得不猜的话,我会说授权可能不能正常工作。你能用卷发得到那一页吗?它应该看起来像:
curl -u <apikey>: https://api.pushbullet.com/v2/users/me假设这是可行的,尝试类似的方法
urlConnection.setRequestProperty("Authorization", "Bearer <apikey>");或者,您可以在HTTP请求上设置标头。这比依赖https://password@domain url更明显。
https://stackoverflow.com/questions/29548753
复制相似问题