简体   繁体   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();

I am trying to get the status messages for my fb account above code throws bad request and this one using facebook api get request says invalid parameters 我正在尝试获取我的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()");

Any help would be appreciated.. facebook giving me headbangings.. :\\ and last thing is the query above works perfect in fql graph api simulator 任何帮助将不胜感激.. Facebook给我headbangings ..:\\,最后一件事是上面的查询在fql图形API模拟器中工作完美

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

I guess you are looking for this: Facebook Graph API - User 我猜您正在寻找: Facebook Graph API-用户
Under Connections you will find "Statuses". 在“连接”下,您将找到“状态”。

In order to get an array of all you statuses, you have to call /me/statuses?access_token=ACCESS_TOKEN You have to have got read_stream permission. 为了获得所有状态的数组,您必须调用/me/statuses?access_token=ACCESS_TOKEN您必须具有read_stream权限。

Hope I could help. 希望我能帮上忙。

Edit: In case of WinRT: I would call Graph API in another way (don't know if it is better but it works too): 编辑:在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