Facebook API Ad creation - facebook

I'm looking for a way to retrieve all Campaign, AdSet and Ad fields to create an Ad using Facebook API, and both AdSet and Ad should depend on previous selection, e.g: if I choose Brand Awareness, I should have relative fields for the AdSet and Ad.
I made some API calls which I could then receive all fields for each step but not relative to the previous step

Related

Determine Custom Conversion Action for AdSet in Facebook Marketing API

I'm using the Facebook API Marketing API to get insight information about different ad campaigns. In the ad campaign insight results, there are a number of actions with values. When I look in the Facebook Ad Manager UI, I see the Result column for Campaigns where it shows me the value I'd like to extract from the API. The problem I'm running into is that I need to programmatically determine what action to pull the value from.
When I look in the AdSet settings in the UI, I see the Conversion Event which ties to a Custom Conversion but I don't know how to get that Custom Conversion ID for the ad set from the API.

How to use the Facebook Ads API to get custom columns in Ads Manager?

I've been experimenting with the Facebook Marketing API to see what I can access in terms of the user's campaigns, ad sets and ads etc. One thing I'm curious by, through the API, is it possible to get the customised columns that the user has selected when viewing metrics for their campaigns, ad sets or ads?
For example, the user has selected to see only Delivery, Cost and Budget metrics for their ad sets. Can I somehow know they've picked these columns from the API alone?
You can't. The Ads manager on Facebook is just another app using the Marketing API (same goes for Power editor, Graph API explorer and others).
Settings of the Ads manager aren't part of ad account data and are private to the app.

Not getting expected campaign IDs when using Facebook Ad Report Stats API

I created an access token with my personal account with additional ad_management permissions. I used curl to exchange this short-lived token for a permanent access token.
The roles page for my ads account says "You can manage campaigns, view reports, and view billing information."
I use this access_token with curl to get the offsite_conversions count from yesterday. The results contain data for a few campaigns. However these campaigns are nowhere to be found in the campaigns list in the ads manager. If I click a campaign and replace the ID in the url with one of the campaign ids int he response I get a "This content is currently unavailable" error page.
Additionally there are at least three campaigns shown in the ads manager's campaign list which do have a few offsite conversions recorded which are not showing up in the response of the Ad Report Stats API call.
How can I get more information to solve this problem?
I was confused by the relatively recent change in the ad campaign terminologies. The reporting api is still using the old terms where a campaign corresponds to what is now an ad set.
If you want to match the campaigns in the ads manager with the campaigns you can fetch with the marketing api I would recommend you add ?fields=name. If you don't recognise the names, then there is probably something wrong :-)

Quering connection of Custom Audience to Ad Groups in Facebook Ads API

What is the best way to get the Ad Groups using a Custom Audience in Facebook Ads Api?
Ads API provides a way to query connections for most objects. For example you could get all Ad Groups of an Ad Set by GET request to https://graph.facebook.com/{ad_set_id}/adgroups. I couldn't find something simular in documentation of Custom Audiences.
I could query all Ad Groups of Ad Accounts the Custom Audience belongs to and check the targeting field of Ad Groups. But this would generate a lot of requests to facebook API which isn't in my and facebooks interest. Isn't their a better way to get this information?
In particular I like to know which Custom Audiences aren't used in any Ad Groups anymore. I have to delete them to not getting problems with limit of 500 Custom Audiences per Ad Account.

Where do I find my Facebook Audience ID?

I need to get the audience ID from the audiences I created in Power Editor but I can find no way to retrieve the Audience ID. I've read https://developers.facebook.com/docs/reference/ads-api/custom-audience-targeting/ but still it does not explain where to get these Audience IDs from.
I'm assuming your app has access to the Ads API; if not, you can't retrieve the Audience IDs via the API, but the IDs probably aren't useful unless you're creating ads via the API anyway
To retrieve audiences you've created in an account via power editor or the API, you can make an API call to https://graph.facebook.com/act_<ACCOUNT ID>/customaudiences which returns the audiences in the account
You'll need a user access token for an admin of the ad account, whcih has the ads_management extended permission
It's possible to get the audience IDs via web interface. Here are the steps:
select an ad set with the audience you need
press Export & Import button
choose Selected
Facebook will generate a .csv file. In this file, you'll find all ad set's parameters, including Included Custom Audiences and Excluded Custom Audiences with IDs.
Once you have a list of all the target audience profile URLs, you can get their Facebook ID numbers by going to www.findmyfacebookid.com
Or you can also find anybody’s ID by adding the word “graph” to their profile URL, like this http://graph.facebook.com/awesomename