Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook API: Determine if Facebook Page is published / unpublished

What is a reliable way to check whether a Facebook Page is published or unpublished using the graph API? I currently do this:

http://graph.facebook.com/{page_id}

and check if the return value is "false". If it's false, I conclude that it's unpublished and if it returns a graph object, then conclude that it's published. But I'm noticing now that a lot of published pages return "false" from the above request.

Here's an example:

this page is published: http://www.facebook.com/AjiRestaurant

but these requests return false: http://graph.facebook.com/104433516257517 (using page Id) http://graph.facebook.com/AjiRestaurant (using page username)

What is the best way to check whether a Page is published?

like image 212
Johnny Oshika Avatar asked Jan 12 '12 18:01

Johnny Oshika


People also ask

How do I know if my Facebook page has been published?

In most cases, Facebook should publish it for you, but we've seen a few instances where admins needed to go in and change their page's settings from “unpublished” to “published.” In your settings, navigate to “General,” and then look for “Page Visibility.” If it says “unpublished,” you've found your problem.

How do I find an unpublished post on Facebook?

To see your unpublished posts, you can use a search bar in the Page Posts tool to navigate through your Ads Posts. This is particularly useful if you have a large volume of posts associated with ads. You can search by the text copy within the ad post using this search bar. You can also search by the Post ID number.


2 Answers

Punch this in under FQL query on http://developers.facebook.com/tools/explorer

SELECT page_id, name, username, is_published
   FROM page 
   WHERE page_id IN 
      (SELECT page_id FROM page_admin WHERE uid = me()) 
   AND is_published=""
   ORDER BY fan_count DESC

That will select all pages in your account and check if they are published, returning all unpublished pages in a list.

like image 200
Luke Rehmann Avatar answered Oct 03 '22 09:10

Luke Rehmann


It turns out that there's no known way to check specifically whether a Page is published / unpublished. The graph API http://graph.facebook.com/{page_id} will return false if any of the following is true:

  • Page is unpublished
  • Page has country restrictions
  • Page has age restrictions

If and only if none of the above settings apply, then http://graph.facebook.com/{page_id} will return an object graph.

Note: I'm assuming that an access token with manage_pages permission is not used for the API calls above. With a proper access token, https://graph.facebook.com/{page_id} will return the object graph, regardless of whether the Page has restrictions or not.

like image 26
Johnny Oshika Avatar answered Oct 03 '22 08:10

Johnny Oshika