图形批量API
这是我在 stackoverflow 上的第一篇文章。
我正在使用 Facebook Graph Batch API 一次请求多个用户的 Feed 更新。 但我真的不知道如何进行适当的错误处理。以下示例应该可以说明我的问题:
批量请求:
user1 - valid access_token
user2 - invalid (password change maybe?)
user3 - valid access_otken
来自 Facebook 的答案可能如下所示:
successful answer
unsuccessful answer (OAuth Exception)
successful answer
但阅读文档后,似乎无法保证答案的顺序。所以我的问题是,如何将答案与批处理请求中的特定部分请求联系起来?
当您没有获得该异常属于哪个请求的信息时,处理 OAuth 异常是相当困难的。
有什么想法吗?
this is my first post at stackoverflow.
I am using the Facebook Graph Batch API to request the Feed-Updates from several users at once.
But I really don't know how the appropriate error handling is done. Following example should demonstrate my problem:
Batch request:
user1 - valid access_token
user2 - invalid (password change maybe?)
user3 - valid access_otken
The answer from Facebook could look like this:
successful answer
unsuccessful answer (OAuth Exception)
successful answer
But reading the docs, it seems like that the ordering of the answer is not guaranteed. So my question is, how do I connect the answers with their specific partial requests from the batch request?
Handling the OAuth exception is quite hard when you don't get the information to which request this exception belongs.
Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不熟悉 PHP SDK,但在 Javascript SDK 上,批处理实际上模拟了各种调用本身,并返回带有
header
和body
等的响应数组放。然后,您可以迭代查找错误和响应。
我假设 PHP SDK 将使用类似的语义。
I'm not familiar with the PHP SDK, but on the Javascript SDK batching actually simulates the various calls themselves and returns an array of responses with
header
andbody
and such-like set.You can then iterate through that looking for errors and responses.
I assume that the PHP SDK will use similar semantics.