簡體   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