如何了解Web通信标准(xauth Restsoapoauthjson)?

发布于 2024-10-08 00:06:07 字数 131 浏览 0 评论 0原文

我是一名 Android 应用程序开发人员(试图成为一名开发人员),我想学习如何通过我的应用程序与网站进行通信。然而,我不知道从哪里开始。你能指出我正确的方向吗?

PS:我认为“网络通信标准”是错误的术语,但我不知道如何称呼它们。

I am an android application developer (trying to be one) and I want to learn how to communicate with web sites from my applications. However, I don't know where to start. Can you point me in the right direction?

PS : I believe "web communcation standarts" is wrong term but i don't know how to call them.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

或十年 2024-10-15 00:06:07

我建议你边做边学。选择一个想法 - 假设您想从 Android 手机上传一张图片到 Facebook。

现在去研究如何做到这一点。 Facebook 公开了他们所谓的“Graph API”,用于所有 Facebook 资源,包括用户、状态和照片等其他事情。 Graph API 是一个 REST API - 换句话说,后端的每个项目都被建模为可通过 URL 访问的“资源”。 (在 wikipedia 上了解有关 REST 的更多信息)。向给定的 URL 发送 GET HTTP 消息,您可以获得有关资源的信息。将 POST 发送到该资源的容器,然后您可以添加另一个资源。在此模型中,要添加照片,您可以 POST 到相册 URL。 在 FB 上了解如何执行此操作。他们称之为“出版”。

但是阅读该文档页面后,您会了解到为了发布,您需要一个授权令牌。
您的应用需要publish_stream 权限。你怎么得到这个?继续阅读 FB 文档,您将看到身份验证和授权指南的链接。这将告诉您如何在 Facebook 应用程序中使用 OAuth 2.0。

您的应用程序将发送第一条微弱的消息,并收到错误响应。为什么?您需要检查该消息。所以你谷歌一下,发现你可以使用http调试代理来帮助你,比如Fiddler2 for Windows,或者Charles for其他系统。因此,您下载该文件,在 Android 设备上设置代理,现在您可以在 PC 上查看传出的 HTTP 消息及其响应。
继续努力,了解完成眼前任务所需的条件:在本例中,将 Android 设备上的照片发布到 Facebook。

达到该目标后,您将学到该问题领域的大量实践知识。然后你可以尝试一个新的目标,并为之努力。

经过几次迭代后,您将学会如何学习,这甚至比学习 REST 或 OAuth 更好。如果你知道如何学习,天空就是极限。

I'd suggest that you learn by doing. Pick an idea - let's say you want to upload a picture from your Android phone to facebook.

Now go and research how to do that. Facebook exposes what they call the "Graph API" for all fb resources, including users, statuses, and photos, among other things. The Graph API is a REST API - in other words each item on the backend is modelled as a "resource" which is accessible from a URL. (Learn more about REST on wikipedia). Send a GET HTTP message to the given URL and you can get information on the resource. Send a POST to the container of that resource, and you can add another of whatever it is. In this model, to add a photo, you POST to the album URL. Read on FB for how to do that. They call it "publishing".

But reading that doc page you learn that in order to POST you need an authorization token.
Your app needs publish_stream permissions. How do you get that? Keep reading in the FB doc and you'll see a link to the Authentication and authorization guide. That tells you about how to use OAuth 2.0 in Facebook apps.

Your app will send its first feeble message out, and get an error response. Why? You'll want to examine the message. so you google and figure out that you can use an http debugging proxy to help you, something like Fiddler2 for Windows, or Charles for other systems. So you download that, set the proxy on your Android device, and now you can view outgoing HTTP messages and their responses on your PC.
Keep plugging along, learning what you need to accomplish the task in front of you: in this example, posting a photo from an android device to Facebook.

After you reach that goal, you will have learned quite a bit of practical knowledge for this domain of problem. Then you can try a new goal, and work on that.

After a few iterations of this, you will have learned how to learn, which is even better than learning REST or OAuth. If you know how to learn, the sky's the limnit.

标点 2024-10-15 00:06:07

首先了解一下HTTP。 HTTP 的内涵远比最初出现的要复杂得多。它是网络上一切事物的构建块。

熟悉这个 http://www.w3.org/ 就不会出错协议/rfc2616/rfc2616.html

Learn about HTTP first. There is far more to HTTP than there first appears. It is a building block for everything on the web.

You will not go wrong by getting very familiar with this http://www.w3.org/Protocols/rfc2616/rfc2616.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文