What is the url to a Facebook open graph post?

前端 未结 5 686
醉话见心
醉话见心 2020-12-28 17:40

Given a post id returned by a graph search, for example: 186173001411937

is there a url to link to the post in facebook? The following url does not work: http://www.

相关标签:
5条回答
  • 2020-12-28 18:04

    I found out, for a graph id 1099696306_140549259338782 the links is build like this: http://www.facebook.com/1099696306/posts/140549259338782

    0 讨论(0)
  • 2020-12-28 18:05

    Honestly, the simplest way I've found to do this is just:

    "http://www.facebook.com/" + postId
    

    Where postId is just the straight id of the post (186173001411937), not the userid_postid variant.

    0 讨论(0)
  • 2020-12-28 18:05
     public <T>getPagePosts(string pageId, string access_token, int limit)
            {
                var client = new RestClient("https://graph.facebook.com");
                var request = new RestRequest(Method.GET);
                var fields = "posts{permalink_url,picture,message,story,created_time,id}";
                request.Resource = "{version}/{object_id}/";
                request.RequestFormat = DataFormat.Json;
                request.JsonSerializer.ContentType = "application/json;";
                request.AddParameter("access_token", access_token);
                request.AddParameter("version", "v2.10", ParameterType.UrlSegment);
                request.AddParameter("object_id", pageId, ParameterType.UrlSegment);
                request.AddParameter("limit", limit);
                request.AddParameter("fields", fields);
                var response = client.Execute(request);
                var result = JsonConvert.DeserializeObject<T>(response.Content);
                return result;
            }
    
    0 讨论(0)
  • 2020-12-28 18:08

    With regards to a public facing page post take the Id returned from the Facebook Graph API e.g. 12345678_12345678 and append it to facebook.com e.g. https://www.facebook.com/12345678_12345678. The post is also highlighted as you access the page.

    0 讨论(0)
  • 2020-12-28 18:17

    with the graph api v2.5 you can use the permalink_url field of the the posts object.

    i.e.:

    www.facebook.com/v2.5/{pagename}/?fields=posts{permalink_url,message,story,created_time,id}
    

    will return

    "posts": {
       "data": [
       {
        "permalink_url": "https://www.facebook.com/etsmtl/posts/10153868925494376",
        "message": "Le Club Cedille organise le prochain Linux-Meetup ce soir à l'ÉTS. Au programme : conférence de James Shubin, ingénieur logiciel sénior chez Red Hat.",
        "created_time": "2016-03-01T15:23:11+0000",
        "id": "8632204375_10153868925494376"
       }, ... }
    
    0 讨论(0)
提交回复
热议问题