0

I want to pull ad data (campaigns, ad sets, & metrics like clicks/impressions/ctr) from Facebook using their API and put it into a database. Facebook's documentation says I need to create an app on their site in order to access the API, but that doesn't seem right. I'm not trying to create an app for my fb page, just want to extract data.

My first choice was to use an ODBC driver from

<a href="http://cdn.cdata.com/help/RBA/odbc/pg_allviews.htm">CData</a>

, which does allowed me to successfully pull data from AdAccounts but threw an error when trying to get AdSets or AdStatistics:

OAuthException Code 10: You do not have sufficient permissions to perform this action.

I made sure to add in a target='act_{myAdAccountId}' parameter to the query, as per their documentation, but it didn't help. I figured this meant I didn't configure the driver properly, so maybe I'd have better luck just coding up a solution in python or php.

Next, I tried to run similar API calls using the Graph API Explorer and got the same error message. I created an access token that had all the extended permissions and then made a request to

GET /v2.4/act_{myAdAccountId}/adcampaigns.

This gave me the exact same OAuthException Code 10 error that I was getting through the ODBC Driver.

Can someone confirm whether it's possible to pull data from the API without building an app? If so, what permissions do I need to enable for my account? I'm already an Ad Account Admin in the "Ads Manager", and couldn't find anywhere else to set permissions.

Thanks!

andyrandy
  • 72,880
  • 8
  • 113
  • 130
Gronk
  • 3
  • 2
  • 4
    _“Can someone confirm whether it's possible to pull data from the API without building an app?”_ – no, it’s not. – CBroe Sep 26 '15 at 21:33

2 Answers2

1

Apps have no direct relation to Pages. You need to create an App for any API access. I did not use the Ads API yet, but i assume you need to use the ads_management permission with your App.

How to create Apps and authorize with the required permissions is explained in the docs: https://developers.facebook.com/docs

Since you asked about Login Review, all the information you need about that can be found in the docs too: https://developers.facebook.com/docs/facebook-login/review

andyrandy
  • 72,880
  • 8
  • 113
  • 130
  • Thanks for the quick response! I did look into creating an app, but you have to register it with FB and they need to approve it before you can use it. All the approval criteria (login info, contact info, screenshots, etc) imply that this will be a public facing web-app, but I wouldn't want any real person using this app as its more like a windows service that just extracts data each day. It sounds like I need create a dummy app and grant it ads_management permissions, then use the access token as part of the api call? – Gronk Sep 26 '15 at 20:43
  • 1
    Of course you have to register it with Facebook. But you don’t need to get it reviewed, if you don’t want it to be used by the general public, but only by yourself (and maybe a couple of other accounts, that can be added to the app.) – CBroe Sep 26 '15 at 21:32
  • i´ve added another link about login review. as CBroe said, you do not need to get anything reviewed if you don´t want to go public with your app. – andyrandy Sep 27 '15 at 11:44
  • Thanks for the help, after creating an app I was able to get this working. I think the confusion was about the whole app concept. I think of an app as something an end user would use/interact with, but it seems fb uses them as a means to access their API and you can use them for whatever you want. I also assumed (incorrectly) that you had to have a reviewed app in order to use it.Thanks again for the help! – Gronk Sep 27 '15 at 23:45
1

I understand this is an old post, but in case if anyone was looking at a similar situation, I was able to call the Facebook Marketing API without building an app.

I posted a similar answer on another more recent question (Do I need a publicly accessible webserver in order to user Facebook's marketing API?), and was curious if this situation puzzled anyone else, which led me to here.

I wrote my API calls using Python 2.7 on Juypter notebook, and I just followed Facebook's Marketing API documentation and examples, modifying with my access tokens and account information.

Community
  • 1
  • 1
Cliff Chew
  • 906
  • 1
  • 7
  • 15