Facebook Marketing API - Get Creatives and Ads data - facebook

I would like to grab the URL of the ad image along with other information.
The ad ID generated from /ads or /adcreatives is not the same as the one generated from the /insights URL.
How can I link the ad image to its respective information?

Related

How to get the Pixel ID of an ad account - Facebook marketing API

Is it possible to get the Pixel ID of an ad account thru the Facebook Marketing API? and if so, how to call the API?
I took a look at the documentation but I'm unable to find out how to do it
audiences-api/pixel/
reference/ads-pixel/
As described in the doc:
If a pixel exists for an ad account, get the code with Marketing API
with an HTTP GET to
https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/adspixels.
Otherwise you could create it:
To create a pixel, HTTP POST to https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/adspixels.

How to get metrics data for only Instagram Ad Campaigns from Facebook Ad Account using Graph API

How do I fetch only Instagram Ad Campaigns instead of all Ad Campaigns from Facebook Graph API.
Here is what I have tried till now.
var url = https://graph.facebook.com/v3.3/"+ad_account_id+"/insights?fields=spend,
clicks,impressions,account_currency,actions&breakdowns=publisher_platform
When I make a request to the above URL, I'm getting all Campaigns data. How do I create the URL to request only Instagram Ad Campaigns?
I have the same problem and found a solution like the one below. you can check it now using Facebook API v14
<your act account>/insights?fields=inline_link_clicks,impressions,reach,frequency,ctr,cost_per_inline_link_click,spend&breakdowns= publisher_platform,platform_position&level=account

How can a user change their graph requested profile image to an image in their album

In this app it generates the users FB profile image, but I want them to be able to select another image if they choose. Parse is my backend. The app runs fine and it goes to the users album, but the picture is not updated in the app. re
You can't update the profile picture with the API. See the docs: https://developers.facebook.com/docs/graph-api/reference/user/picture/#Creating
More information - and possible workarounds:
how to set a facebook profile picture using the graph api
Can I set a users profile image using the Facebook API?
Facebook API/PHP - Is it possible to change a user's profile image via FB Graph API?

Facebook GraphAPI to retrieve all user profile images

I need to retrieve all user profile images by user id and access token using Facebook Graph API.
I can take all user's albums in this way: {user-id}/albums?fields=type
In this list I can see an album with type = profile.
Is possible to change my request to filter directly this album?
Are there an others methods to take all user's profile images (for example using a single FB request)
You canĀ“t filter, you have to get all albums and browse through them in your code to find the profile album. After that, you just need to make another API call to /{album-id}/photos to get access to the photos.

Generate Facebook user picture using third_party_id

I've had a look through Facebook's online documentation and cannot find a way to manually construct a Facebook user's profile picture Uri using the user's third party ID (third_party_id) field.
For example (doesn't work):
https://graph.facebook.com/<FACEBOOK_THIRD_PARTY_ID>/picture?type=square
http://developers.facebook.com/docs/reference/api/user/
third_party_id: An anonymous, but unique identifier for the user; only returned if specifically requested via the fields URL parameter
Using Facebook ID:
Using the user's Facebook ID to retrieve their profile picture image Uri works:
https://graph.facebook.com/<FACEBOOK_ID>/picture?type=square
For example (works):
<img src="https://graph.facebook.com/568916752/picture?type=square" />
Using Facebook Username:
Using the user's Facebook username to retrieve their profile picture image Uri works:
https://graph.facebook.com/<FACEBOOK_USERNAME>/picture?type=square
For example (works):
<img src="https://graph.facebook.com/brett.scott/picture?type=square" />
Facebook Third Party ID:
Best practices suggests that I store the user's third_party_id instead of the user's Facebook ID (id) in my database. I shouldn't be publicising a user's Facebook ID to other user's of my website. The reason? Because once a user can see another user's profile picture Uri, which contains their Facebook ID, they can find the other person's profile (see example below). I'm sure there's other reasons too.
Load profile picture:
https://graph.facebook.com/brett.scott/picture?type=square - or -
https://graph.facebook.com/568916752/picture?type=square
Then any user can load the above user's profile:
http://www.facebook.com/brett.scott - or -
http://www.facebook.com/568916752
I do not want to make a request using the Facebook Graph to obtain each user's profile picture Uri picture because it's too slow. If there are 20 Facebook pictures on a page, that's 20 HTTP requests back to Facebook's servers. I'm aiming for zero.
Is there another way to obtain a Facebook user's profile picture using their third_party_id or is it a missing feature?
https://graph.facebook.com/<FACEBOOK_THIRD_PARTY_ID>/picture?type=square
For example (third_party_id generated for my application):
https://graph.facebook.com/0u0JrPIriHa3fgEDostj7v8dbdo/picture?type=square
The Third Party ID is a unique, but anonymous identifier. It is meant to allow an advertiser to track unique users. It is specifically designed to NOT be resolvable to a Facebook ID.
For your site, you can store Facebook user ids in your database without violating the TOS, so long as you keep that data private.
When you request a photo from the Graph API, Facebook returns a CDN URL to the photo. You can publish that URL. You aren't supposed to store this data for longer than would be expected in a cache.
To get 20 pictures in one call, you can call the endpoint:
https://graph.facebook.com/picture?type=square&ids=UID_1,USERNAME_2,...UID_n