Facebook的图形API备注列表排序,像“排序依据=递减”? [英] facebook graph api comment list sort , like 'orderby=desc'?

查看:718
本文介绍了Facebook的图形API备注列表排序,像“排序依据=递减”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用图形API来获取图片的意见,但我想首先创建时间对结果进行排序,然后返回到最新的数据。类似于SQL语句由CREATE_TIME倒序',我不知道是否有这样的参数。

目前用来抵消和限制访问的最新数据,但也知道的评论数目,

 页面大小= 25;
偏移量= comments.count - 页面大小;
极限= 25;


  

URL =htt​​ps://graph.facebook.com/+ OBJECT_ID +/注释的access_token =?+ +的access_token与&限额=+限制+&放大器;偏置=+限制;


下一页:

 偏移 -  = 25

但数值comments.ount有时是不准确的。

和请求URL的结果返回有时不匹配


  

是否有很好的解决方案。


  
  

或者我用了错误的方式(限制和偏移参数)!!!



感谢您的回答。

图形API缓存的存在?

我发布一条消息和46 comments.requests网址,设置参数:


  

偏移= 0&功放;限= 1


  
  

然后应该返回到最后评论(最新一期),实际回报注释的中间,我测试了几次,设置
  偏移和限制。根据返回的结果,中间的一个是
  最新评论


如果我设置的限制值大于comment.count时,返回的数据是一切,官方网站和Facebook一致

由于缓存的原因?

再次感谢〜


解决方案

@dbau - 你还是最好使用FQL。根据我的经验,除非你正在一个非常简单的通话,你必须对你通过图形API调用得到什么很难控制。

为什么你不希望使用FQL? FQL是图形API的端点。还有只能通过FQL返回一些数据。

这将让你你正在寻找的结果。查询需要进行URL连接codeD。我把它在清晰的纯文本。

  https://graph.facebook.com/fql?access_token=[TOKEN]&q=
    SELECT标识,fromid,文本,时间,很喜欢,user_likes FROM评论
      WHERE OBJECT_ID = [OBJECT_ID] ORDER BY时间DESC LIMIT 0,[N]

您可能会发现你没有得到 [N] 注释每次回来,因为Facebook过滤掉不给的access_token可见项目所有者的 的运行查询后。你既可以达到极限,过滤掉退回,或者如果您使用的是用户的access_token ,您可以添加任何多余的结果和can_like = TRUE WHERE 子句来保证,如果他们存在, [N] 职位,可见当前用户被返回。

I use graph api to get the picture's comments, but I want to first sort the results by creating time and then return to the latest data. Similar to the sql statement 'order by create_time desc', I do not know if have such a parameter.

Currently used to offset and limit access to the latest data, but also know the total number of comments,

pagesize = 25;
offset = comments.count - pagesize;
limit = 25;

url = "https://graph.facebook.com/" + object_id + "/comments?access_token=" + access_token + "&limit=" + limit + "&offset=" + limit;

next page:

offset -= 25

but comments.ount of numerical sometimes is not accurate

and the result of the request URL to return to sometimes don't match

Whether to have very good solution

Or I used the wrong way (‘limit’ and ‘offset’ Parameter)!!!


Thank you for your answer.

"Graphics API" the existence of the cache?

i post a message and 46 comments.requests url, set the parameters:

offset=0&limit=1

Then it should return to the last comment (latest one), the actual return to the middle of a comment, and I tested a few times, set the offset and limit. According to the returned results, the middle one is the latest comment

If I set the limit value is greater than the 'comment.count', the returned data is all, the official website and facebook consistent

Because the cache reason?

Thanks again~

解决方案

@dbau - You are still better off using FQL. In my experience, unless you are making a very simple call, you have very little control over what you get via a Graph API call.

Why don't you want to use FQL? FQL is an endpoint of the Graph API. There is still some data that can only be returned via FQL.

This will get you the result you're looking for. The query needs to be URL encoded. I left it in plain text for clarity.

 https://graph.facebook.com/fql?access_token=[TOKEN]&q=
    SELECT id, fromid, text, time, likes, user_likes FROM comment
      WHERE object_id = [OBJECT_ID] ORDER BY time DESC LIMIT 0,[N]

You may find you don't get [N] comments returned each time, because Facebook filters out items that are not visible to the access_token owner after the query is run. You could either up the LIMIT and filter out any excess results returned or if you are using a user access_token, you could add AND can_like = TRUE to the WHERE clause to be guaranteed that, if they exist, [N] posts visible to the current user are returned.

这篇关于Facebook的图形API备注列表排序,像“排序依据=递减”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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