Determine Object_ID of a URL to use with the Faceb

2019-03-11 11:56发布

问题:

I am trying to learn how to use the Facebook Open Graph API and have a question on how to determine the object_id of my site. I need this object_id so that I can do other queries, such as I want to get a list of users who have liked my site within a given time period.

Based on other Stackoverflow questions I have seen that I should be able to run this query to get the object_id

select id from object_url where url in ('www.bubbasgameroom.com', 'bubbasgameroom.com')

When I run that query it comes back with an empty result. When I run the following query, I see that my page has been liked 21 times

select total_count from link_stat where url in ('www.bubbasgameroom.com', 'bubbasgameroom.com')

What am I missing here? Any help will be greatly appreciated.
Thanks!

回答1:

Most likely the url should be identical to the og:url meta tag if used on your website. Also you need to append the http:// part for it to work. For example this would work:

SELECT url,site,id 
FROM object_url 
WHERE url IN ( 
    'http://developers.facebook.com',
    'http://www.imdb.com/'
)

Result:

[
  {
    "url": "http://developers.facebook.com",
    "site": "developers.facebook.com",
    "id": 113167538713703
  },
  {
    "url": "http://www.imdb.com/",
    "site": "www.imdb.com",
    "id": 6903354771
  }
]

But this doesn't:

SELECT url,site,id 
FROM object_url 
WHERE url IN ( 
    'developers.facebook.com',
    'www.imdb.com/'
)