Facebook API: Determine if Facebook Page is published / unpublished

facebookfacebook-graph-apifacebook-page

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?

Best Answer

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.

Related Topic