繁体   English   中英

FQL Facebook API查询

[英]Fql facebook api queries

 var webRequest = (HttpWebRequest)HttpWebRequest.Create("https://graph.facebook.com/");
            webRequest.Method = "POST";
            webRequest.ContentType = "application/x-www-form-urlencoded";

            var requestString = "fql?q=SELECT status_id, message FROM status 
               WHERE uid=me()";

            byte[] bytedata = Encoding.UTF8.GetBytes(requestString);

            webRequest.ContentLength = bytedata.Length;

            var requestStream = webRequest.GetRequestStream();
            requestStream.Write(bytedata, 0, bytedata.Length);
            requestStream.Close();

            var response = webRequest.GetResponse();
            var responseStream = new StreamReader(response.GetResponseStream());
            var responseString = responseStream.ReadToEnd();

我正在尝试获取我的fb帐户的状态消息,上面的代码抛出错误的请求,而使用facebook api get request的该请求说无效参数

                string accessToken = ViewState["accessToken"].ToString();
            Facebook.FacebookClient fb = new FacebookClient(accessToken);
            dynamic me = fb.Get("/me");

            var id = me.id;

            string query = "SELECT status_id, message FROM status WHERE uid=me()";

            var posts = fb.Get("/fql?q=SELECT status_id, message FROM status WHERE uid=me()");

任何帮助将不胜感激.. Facebook给我headbangings ..:\\,最后一件事是上面的查询在fql图形API模拟器中工作完美

https://developers.facebook.com/tools/explorer?method=GET&path=uridfields%3Did%2Cname

我猜您正在寻找: Facebook Graph API-用户
在“连接”下,您将找到“状态”。

为了获得所有状态的数组,您必须调用/me/statuses?access_token=ACCESS_TOKEN您必须具有read_stream权限。

希望我能帮上忙。

编辑:在WinRT的情况下:我会以另一种方式调用Graph API(不知道它是否更好,但它也可以工作):

// Example Uri
Uri requestUri = new Uri("https://graph.facebook.com/me/statuses?access_token=ACCESS_TOKEN");    

HttpClient client = new HttpClient();
HttpResponseMessage response = await client.GetAsync(requestUri);

string content = await response.Content.ReadAsStringAsync();
return content;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM