我有以下查询得到 500 错误。我认为这是因为权限,但我设置了 user_likes 和 friends_likes 权限。
SELECT user_id, url FROM url_like WHERE strpos(url,'myurl') AND user_id IN (SELECT uid2 FROM friend WHERE uid1 = me())
这个工作正常。
SELECT user_id, url FROM url_like WHERE strpos(url,'myurl') AND user_id = me()
任何想法为什么我不能让我的朋友喜欢某个网址?我知道这是可以做到的。我见过很多其他显示数据的网站。
我在 c# 中这样做。我的第二个查询目前已被注释掉,直到我得到第一个查询。
dynamic resultLikes = fb.Get("fql",
new
{
q = new
{
urlLikes = "SELECT user_id, url FROM url_like WHERE strpos(url,'myUrl') AND user_id IN (SELECT uid2 FROM friend WHERE uid1 = me())",
//resultLike = "SELECT uid, name, pic_small FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me() AND (uid2 IN (SELECT user_id FROM #urlLikes)))",
}
});
我将发布代码,希望有人知道出了什么问题。我已经尝试了两种不同的方式。
首先使用Httpwebrequest:
private void GetMyLikes()
{
//string URL = "https://graph.facebook.com/" + userID + "/picture";
string url = String.Format("https://api.facebook.com/method/fql.query?query=SELECT user_id, url FROM url_like WHERE user_id IN (SELECT uid2 FROM friend WHERE uid1 = me())&access_token={0}&format=json", accessToken);
HttpWebRequest req = (System.Net.HttpWebRequest)HttpWebRequest.Create(url);
req.AllowWriteStreamBuffering = true;
req.Timeout = 200000;
HttpWebResponse resp = req.GetResponse() as HttpWebResponse;
StreamReader reader = new StreamReader(resp.GetResponseStream());
string likes = reader.ReadToEnd();
resp.Close();
}
使用 C# SDK
private void getFriendsProductLikes()
{
if (!string.IsNullOrWhiteSpace(accessToken))
{
FacebookClient fb = new FacebookClient(accessToken);
dynamic resultLikes = fb.Get("fql", new { q = "SELECT user_id, url FROM url_like WHERE user_id IN (SELECT uid2 FROM friend WHERE uid1 = me())" });
}
}
我目前可能设置的权限比我需要的要多。
public const string SCOPE = "user_likes,friends_likes,user_status,friends_status,publish_actions,user_location,friends_location,user_checkins,friends_checkins,read_stream,user_activities,friends_activities,user_birthday,friends_birthday,user_about_me";
谢谢,
朗达