I need to find the page ID connected to my campaign or adset (no matter which of them) but it's not clear to me how to find it.
I have the campaign ID and all the connected adset IDs so I can use both.
I tried using this doc https://developers.facebook.com/docs/marketing-api/reference/ad-campaign
What I tried is to get the page_id from the promoted_object but sometimes it has not the page_id in it.
Am I doing it wrong?
Which is the right way to get the page_id?
create campaign
create adset (need campaign_id)
create creative,
In this step, pageid will be added.
try to get creative and get page_id from it.
hope this will be helpful.
Related
I'm trying to load a single page post data from Facebook. As you may know some posts have IDs like PAGE_ID + '_' + POST_ID and some have just POST_ID. When I have Page_ID and Post_ID available (I get these IDs from ad creatives), and want to get the post data, I don't know if I should call
https://graph.facebook.com/POST_ID
or
https://graph.facebook.com/PAGE_ID_POST_ID
Is there a normalised way on graph api to get post data? Should I make another request if one of the above fails?
A post_id is a universal unique id in the Facebook Grap. For as answer to your question:
https://graph.facebook.com/POST_ID
The post_ids have indeed sometimes some logic that is like pageid_postId. But don't think about it. PostId is uuid in Facebook.
And if you have more questions or issues you can easily the GRAP explorer and enter whatever id and check the result:
https://developers.facebook.com/tools/explorer
And enter the id in the text field after the GET dropdownlist.
If I create a page, is it possible to get a list of all the people that like that page on facebook. For example, if I create http://www.facebook.com/honeybadger, as an admin can I get a list of everyone that likes it?
You can't get a list of users who like a URL or Facebook page anymore. Facebook has gone and taken the page_fan and url_like tables and made the only indexable column on these the uid field.
Trying something like this
SELECT uid FROM page_fan WHERE page_id IN (SELECT page_id FROM page WHERE username = "honeybadger")
Throws an OAuth exception: "Your statement is not indexable. The WHERE clause must contain an indexable column. Such columns are marked with * in the tables linked from http://developers.facebook.com/docs/reference/fql"
The only thing you can do is create an app, have users authorize your app, then test if an authenticated user likes a specific page or link. If you ask for the right permissions, you can also test to see if their friends like your app.
This change was implemented to prevent spammers from harvesting Facebook IDs from their page fans or url likers.
The Facebook documentation seems to give the exact answer to your question.
https://developers.facebook.com/docs/reference/fql/like/
SELECT user_id FROM like WHERE object_id = <INSERT_FACEBOOK_OBJECT_ID_HERE>
simpler way is to get it thru graph api
https://graph.facebook.com/honeybadger/likes?access_token=valid_access_token
I've been scouring the docs for a while now and can't seem to find a way to accomplish this. The information is available publicly (on a facebook page ... the link says "View all # shares") but I can't seem to find a way to access this info either via FQL or the graph API.
I know I can get a list of likes for a given post:
https://graph.facebook.com/87236249496_134765166623967/likes
The goal is to get a list of people who've shared -- but there doesn't seem to be the same sort of thing for shares. Am I missing something?
You can do it via "graph.facebook.com/OBJECT_ID/sharedposts" connection:
I figure it out this connection via metadata=1 parameter:
Go to... http://www.facebook.com/ajax/shares/view/?target_fbid=10154612868272801&__a=1
10154612868272801 is Facebook story ID, __a stands for asynchronous.
You will see large amount of text/JSON, it is basically HTML & JS for little popup window. There is portion of text like hovercard.php?id=# where # is Facebook user ID, using preg_match_all you then get all of the user ID's who shared that post.
Eg: 100000541151971 (Eric) and 9204448 (Courtney)...
Unfortunately, you must be logged into Facebook to do first step, figure it out :)
I think you can get the share_count from stream table by FQL query just like
SELECT type, source_id, share_count, permalink, description, post_id, actor_id, target_id, message , share_count
FROM stream
WHERE filter_key = 'others' and post_id = '87236249496_134765166623967'
you can test it https://developers.facebook.com/tools/explorer/
Note: you have to take the read_stream permissions as explained here
Tye this link: https://graph.facebook.com/134765166623967/sharedposts (with a valid access_token)
The id in the link is the wallpost id (87236249496_134765166623967) minus the page id (87236249496) and minus the underscore.
You'll also need the read_stream permission
I know you're looking to get at shares through the post_id, but can you settle for finding shares by page_id instead of post_id?
If you can, then you can use the following FQL to get the data you're looking for.
SELECT via_id, created_time, owner_comment
FROM link
WHERE owner = me()
You can then compare via_id against the posts author (page ID) to determine if this share came from the post author in question.
Unfortunately, there seems to be a bug with the data return where some of the via_ids come back as 0. There is a ticket in with Facebook which, at the time of this post, has been open for three weeks at medium priority. I have no idea if this issue is specific to my app or affects everyone, but that query might get you what you want.
Am working on a facebook application and i will like to display to the user his/her friends that are already users of the application.
I have been able to get the facebook user ids of the users. Now am trying to find out if there is a facebook api resource i can use to render the user's pictures and names by just passing the ids to it.
thanks in advance.
You should try out with FQL and the user table.
http://developers.facebook.com/docs/reference/fql/user/
There you have a is_app_user field, which can be queried. The table is indexed by uid, which means you can use ids of friends to check.
With fql like this you should be able to read all friend ids who are using your app, assuming $user is current user id:
SELECT uid FROM user WHERE is_app_user = 1 AND uid IN (SELECT uid2 FROM friend WHERE uid1 = $user)
Please check out this post: Can the full name and profile picture of a user signed in via Facebook API be displayed publicly?
Good luck! :)
As others have mentioned, you can use FQL to get the information you need. But if you just want to use the user ID, you can use FBML and have the Facebook javascript lib render the FBML on the client side. You would want to use fb:name and fb:profile-pic then.
You could also use fb:multi-friend-selector if that is what you are looking for.
Have a look at this documentation page http://developers.facebook.com/docs/reference/fbml/#user/groups.
Use the fb:name tag for the name and fb:profile-pic for the profile picture.
Just loop through all the IDs and display the those two tags for each of them.
I think that what you are looking for it's the Facebook facepile, it's a social plugin.
Just give the app_id and it shows the faces of your friends using it.
Using the Facebook API with the FQL language, how can I get a list of the users that liked a given URL? I got the URL and want to query Facebook to see how many people and what users liked that URL.
Using PHP or ASP.Net... doesn't matter, just want to know how to write the FQL query.
Sadly this data isn't available. What's possible via the Link Graph API objects and the link FQL table is just retrieving a given instance in which a link was shared by a user. You can get the count of likes on a user's posting of a link, but this likely isn't what you want.
Discussed this 3-6 months ago with guys at Facebook, and the consensus then was also that getting this data via API is impossible. As far as I know things haven't changed, and there are some privacy arguments for keeping this data out of the API.
'SELECT user_id FROM like WHERE object_id IN (SELECT link_id from link WHERE url = 'YOUR URL HERE' AND owner = 'YOUR USER ID HERE' '
Like FQL Table
Link FQL table
In order to access user's likes, the application needs to have user_likes permission from the user. After that if you access http://graph.facebook.com/me/likes with appropriate access tokens, all the object IDs (including external websites), the current user has liked will be listed.
(this is in reply to bounty question, which seems a bit different from the original question asked on this page)
It's not using FQL but...you can see the most recent 500 users that have like your page by going to: https://www.facebook.com/browse/?type=page_fans&page_id={id} but you would have to scrape this to get the information and it won't work for more people besides the most recent 500. Here's the gotcha, you've gotta be an admin of the page_id to see it.
You can only get the fans of pages that you are an administrator for. So you have to provide an access token with your request associated with an admin account of the page you are trying to get the fans.
Facebook's FQL documentation here: https://developers.facebook.com/docs/reference/fql/page/ tells you how to do it. Run the example SELECT name, fan_count FROM page WHERE page_id = 19292868552 and replace the page_id number with your page's id number and it will return the page name and the fan count.