Cannot retrieve a list of campaigns for some accounts - facebook

I'm experiencing troubles requesting list of campaigns for some accounts. I'm requesting data with C# SDK , and my query is pretty simple: /v2.2/act_<account id>/adcampaign_groups.
For some accounts this works fine, but for some it returns OAuthException #10 (You do not have sufficient permissions to perform this action).
The result is the same when using Graph Explorer, so it doesn't seem like SDK issue. I also get the same error when requesting /v2.2/act_<account id>. But I see this account with all its properties when requesting /v2.2/me/adaccounts.
I have administrator permissions in ads cabinet, and I can see campaigns for these faulty accounts in web UI, so I don't see any reason why it shouldn't work.
Any help?

Related

Facebook Marketing API - no app?

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
CData
, 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!
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
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.

facebook graph api /me/friends started to return empty with test users

Before this is tagged as a duplicate (or infinitycate, as I've seen searching here), I know facebook graph api friends request returns only friends who have the app installed.
That being said, I have my app on develop stage, and I've created several test users and set friendships among them. I've been able to get their friends (only the ones I've setted as friends of the logged one). Thus far, all OK.
The problem I have is something that happened me twice; after I log in into facebook with a test user (one time from desktop PC, another with android app), I've started to receive the /me/friends request empty. I have tried loggin off and on again, erasing cache & data, looking for some profile configuration... with no luck. I haven't seen any policy regarding loggin test users and loosing some functionality... any ideas?
Regars!

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 :-)

Get Facebook user work

I'm trying to write some application that scan user's group posts. When I read the group feed posts using the API I’m interested to get some information on the one who posted this post ('from' field). The graph API today gives only the id and the name of this person. I'm interested also in his work place. I tried taking the user id and to access the / resource and to get his work field , but this field is not returned. When I’m looking on the same user profile in Facebook I see his work place is public, even I’m not connected with him.
Anything I can do to get this user work with the existing Facebook API?
Normally, if the work history info is not public, you'll need the "user_work_history" permission (see https://developers.facebook.com/docs/facebook-login/permissions#reference-extended-profile).
If it's public, you can try calling the
/{USER_ID}?fields=id,work

Retrieval of user's likes using Facebook Graph API sometimes fails

in our game I'm checking if user is liking some of our Facebook sites.
For most users its working but there are some complaining that they are
having problems with this functionality.
1) I'm requesting "user_likes" permission during logging to Facebook
( users must be logged ).
2) I also take into account so called "paging" of result via Graph API.
( I'm retrieving all user's like-ids piecewise and after many tests
I assumed that it's working fine :o) )
3) Those users that were reporting that this check isn't working
really "like" those sites (before running this check).
So my assumption is that request "me/likes" fails or doesn't work
as expected under some conditions. Can someone help me with this
problem?
It seems that I'm not alone because I found these (unluckily unanswered):
https://stackoverflow.com/questions/10772814/checking-facebook-graph-api-for-user-likes-fails-for-some-users
http://facebook.stackoverflow.com/questions/10109773/cant-obtain-user-likes-in-some-cases-using-facebook-graph-api
The only cause I can think of is the Graph cache not being up to date with the user's Like data. If the user only just liked a page, and then you requested the Like data via Graph API, the data may not have been updated yet and therefore would show up as a "non-Liked" page.
Try using a FQL query to do the same check - but instead of paging through the user's like, do a direct check on the Page ID, User ID and Like status. You will have to join across multiple tables to get it working.