批量请求图api iPhone xcode?
我将通过像这样的批量请求通过图形 api 从 facebook 获取四个或多个记录
NSString *jsonRequest1 = @"{ \"method\": \"GET\", \"relative_url\": \"133028623426021\" }";
NSString *jsonRequest2 = @"{ \"method\": \"GET\", \"relative_url\": \"152881298125928\" }";
NSString *jsonRequest3 = @"{ \"method\": \"GET\", \"relative_url\": \"20870926514\" }";
NSString *jsonRequest4 = @"{ \"method\": \"GET\", \"relative_url\": \"124551187593106\" }";
NSString *jsonRequestsArray = [NSString stringWithFormat:@"[ %@, %@, %@, %@ ]", jsonRequest1, jsonRequest2,jsonRequest4,jsonRequest3];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObject:jsonRequestsArray forKey:@"batch"];
FbGraphResponse *fb_graph_response1 = [fbGraph doGraphPost:jsonRequestsArray withPostVars:params];
NSLog(@"%@",fb_graph_response1.htmlResponse);
但我的响应是这样的
response =
我如何通过图形 api 获得响应批量请求?
I am going to fetch four or multiple records of from facebook through graph api with batch request like this
NSString *jsonRequest1 = @"{ \"method\": \"GET\", \"relative_url\": \"133028623426021\" }";
NSString *jsonRequest2 = @"{ \"method\": \"GET\", \"relative_url\": \"152881298125928\" }";
NSString *jsonRequest3 = @"{ \"method\": \"GET\", \"relative_url\": \"20870926514\" }";
NSString *jsonRequest4 = @"{ \"method\": \"GET\", \"relative_url\": \"124551187593106\" }";
NSString *jsonRequestsArray = [NSString stringWithFormat:@"[ %@, %@, %@, %@ ]", jsonRequest1, jsonRequest2,jsonRequest4,jsonRequest3];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObject:jsonRequestsArray forKey:@"batch"];
FbGraphResponse *fb_graph_response1 = [fbGraph doGraphPost:jsonRequestsArray withPostVars:params];
NSLog(@"%@",fb_graph_response1.htmlResponse);
But my response is like this
response =
How can i get response through graph api with batch request?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于request_ids,不需要创建批量请求。您可以简单地将它们作为逗号分隔列表传递,并避免执行批量请求。
您的最终图表 URL 应该是这样的:
For request_ids, you do not need to create a batch request. You can simply pass them as a comma separate list and avoid doing a batch request.
Your final graph URL wants to look like: