图批处理 API [英] Graph Batch API

查看:47
本文介绍了图批处理 API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在 stackoverflow 上的第一篇文章.

this is my first post at stackoverflow.

我正在使用 Facebook Graph Batch API 一次从多个用户请求提要更新.但我真的不知道如何进行适当的错误处理.以下示例应说明我的问题:

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:

批量请求:

user1 - valid access_token
user2 - invalid (password change maybe?)
user3 - valid access_otken

来自 Facebook 的答案可能如下所示:

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?

当您没有获得该异常属于哪个请求的信息时,处理 OAuth 异常会非常困难.

Handling the OAuth exception is quite hard when you don't get the information to which request this exception belongs.

有什么想法吗?

推荐答案

我对 PHP SDK 不熟悉,但在 Javascript SDK 上批处理实际上模拟了各种调用本身并返回带有 header 的响应数组body 之类的集合.

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 and body and such-like set.

然后您可以遍历它以查找错误和响应.

You can then iterate through that looking for errors and responses.

我假设 PHP SDK 将使用类似的语义.

I assume that the PHP SDK will use similar semantics.

这篇关于图批处理 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆