【问题标题】:Use Facebook C# SDK to Search for Places使用 Facebook C# SDK 搜索地点
【发布时间】:2011-05-26 19:57:44
【问题描述】:

我想使用 Facebook C# SDK 在 Open Graph 上运行搜索

https://graph.facebook.com/search?q=coffee&type=place&center=37.76,-122.427&distance=1000&access_token=

但我不确定是否应该使用 Query 或 POST 或某种形式的 FQL。

更新:据我所知,我可以构建这样的查询:

   var result = fb.Get(String.Empty,
                         new Dictionary<string, string>()
                              .SelectFields(new[] { "picture" })
                              .SelectIds(new[] { "123741737666932", "100001241534829" })
                              .SelectField("id"));

我可以将 fb.Get 更改为 fb.Get("search"),但我不确定之后要选择什么。

【问题讨论】:

    标签: c# facebook facebook-c#-sdk


    【解决方案1】:

    此代码将为您提供您想要的:

    Dictionary<string,object> searchParams = new Dictionary<string,object>();  
    searchParams.Add("q", "coffee");     
    searchParams.Add("center", "37.76,-122.427");     
    searchParams.Add("type", "place");     
    searchParams.Add("distance", "1000");
    
    FacebookClient fbClient = new FacebookClient(token);
    var searchedPlaces = fbClient.Get("/search", searchParams); 
    

    【讨论】:

    • 哈哈,你只是勉强打败了我。 :)
    【解决方案2】:

    想通了。

    Dictionary<string, string> dict = new Dictionary<string, string>();
    dict.Add("q", "coffee");
    dict.Add("type", "place");
    dict.Add("center", "-37.01,31.0015");
    dict.Add("distance", "5");
    
    var result = fb.Get("search", dict);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多