图批处理 API

编程入门 行业动态 更新时间:2024-10-28 10:33:38
本文介绍了图批处理 API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

这是我在 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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-18 09:57:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/935704.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:批处理   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!