I was looking for any way of getting the fb pixel id using the graph api or the list of fb pixel id for an fb account using the fb login oauth flow. But after looking at various docs , I couldn't find any api call that would return such data.
From Graph Api explorer:
https://developers.facebook.com/tools/explorer/
I tried using the adaccounts to get the id and then the pixel id but this did not work:
/v2.11/me/adaccounts
To get adaccount id
then
/v2.11/act_729987647077200/adspixels
This returned
{
"error": {
"message": "(#274) The ad account is not enabled for usage in Ads API. Please add it in developers.facebook.com/apps -> select your app -> settings -> advanced -> advertising accounts -> Ads API. Account 729987647077200 not enabled for this application.",
"type": "OAuthException",
"code": 274,
"fbtrace_id": "GYRwLPodWzg"
}
}
This required me setup the ad account in my app.
But for my use case I just want the users pixel id of the fb pixel to start tracking the users website that I have with me hosted. So that the user can see the tracking in his account of his website.
I wanted to automate the process of pixel id by fb oauth login and permissions flow instead of asking user to manually provide the pixel id by copy paste.
What you write is correct and should work
/act_<ACCOUNT_ID>/adspixels
will return you the pixel ids.
You can then get information about the pixel with
/<PIXEL_ID>?fields=name,owner_ad_account,is_unavailable,last_fired_time,owner_business
https://developers.facebook.com/docs/marketing-api/reference/ad-account/adspixels/
Related
Things were working find until yesterday. I'm developing a simple Instagram app, I made a basic login flow. Now, when I try to log in for the app with a business facebook account I get a message "You don't have any Instagram Business Accounts linked to a Page.", which is funny, because in business account manager, in "Instagram Accounts" tab, I have my business instagram account listed; trying to remove it gives me a message: "This Instagram Account can't be removed because it's already linked to an Instagram business profile.". Great, seems like it SHOULD be working. It isn't but, the second part follows.
I generated an access token for that instagram account for Instagram Basic Display API, queried node https://graph.instagram.com/me, I got my account ID in response. Now, I tried to query the user using Graph API - https://graph.facebook.com/17841431928202825 - but in response I get:
{
"error": {
"message": "Unsupported get request. Object with ID '17841431928202825' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "AwbBT4_pYZjEg5HbG1UHYPi"
}
}
For this I'm using an access token generated for the facebook account.
Do you have any idea why the hell it can't see my account both querying the API and from Business manager?
I'm using the Facebook Live Video API for testing purpose.
I've created a Test User, associated with my Facebook App, with the following permissions: publish_actions, user_videos, publish_pages, manage_pages
Using graph API explorer, I can make a POST request on /{user_id}/live_videos, using the Test User ID and Access Token (got it from the My App -> Role -> Test Users).
But, if I create a page with the Test User (logged in with its email), POST resquest on /{page_id}/live_videos, with the test user page ID and Page Access Token with required permissions, I get an error:
"message": "(#100) No permission to perform current operation.",
"type": "OAuthException",
"code": 100,
I have the exact same issue when I'm not using a Test User, i.e. when I try to post live videos on a page id with an admin page token, while it works on its user id with user access token.
I've followed these documentation:
Live Video API
Why can't I POST live_videos on page ID with a page access token while it works on user ID with user access token?
Best regards.
Nico
POSTing a live_video with the page access token should work now. After chatting with the engineers at FB, they fixed the problem, so it wasn't an issue with just you.
Is it possible to get name and photo from v2.0 app scoped Facebook id, without an access token?
This used to be possible in v1.0 (with original Facebook ids), see the link.
But in v2.0 with app scoped ids, I get this error:
{
"error": {
"message": "Unsupported get request.",
"type": "GraphMethodException",
"code": 100
}
}
This seems to me to be a common use case, where in a game, playerA is logged into Facebook and playerB is not using Facebook, and you want playerB to be able to obtain playerA's Facebook name and photo, without logging in.
That's intentional - in v2.0 no API calls can be made without an access token except the call to retrieve a user's profile picture
You should store the name in your own database, and retrieve the photo using the app scoped ID - since you'll already be deciding which users to show based on your own database you should already have both pieces of information in your system and not need to fetch anything from Facebook's API without an access token
I'm trying to get public profile using user_token. I registered FB app and get user_token from page: https://developers.facebook.com/tools/access_token/
but when I try to get public profile https://graph.facebook.com/100000378611443?limit=1000&access_token={user_token}
I see an error:
{
"error": {
"message": "The global ID 100000378611443 is not allowed. Please use the application specific ID instead.",
"type": "OAuthException",
"code": 2500
}
}
But if I use user_token in above URL from another my app I can successfully get public user profile.
What am I doing wrong?
Thanks.
Since v2.0 of Facebook API apps are no longer allowed to use global IDs, just app-scoped ID. These ID are generated when a user logs in onto your application.
If you are attempting to retrieve current logged in user's information, you should use /me endpoint along with the user's access token: https://graph.facebook.com/me?access_token={user_token}
Note that with these new scoped IDs, apps are not allowed to retrieve any data from users who haven't gave permissions to the app.
Cheers
You can still use the older version of Facebook Graph API V1.0 which will continue to exist until April 30th, 2015.
https://graph.facebook.com/v1.0/100000378611443
You must use access token, not user token! You can obtain one from Graph API Explorer here https://developers.facebook.com/tools/explorer
Then you must have at least user_about_me permission to get profile data. As many user data permissions you have, as many endpoints and data you obtain. Keep in mind, access token you get from Graph API Explorer is short living - expires in an hour or so. More about tokens and their terms here: https://developers.facebook.com/docs/facebook-login/access-tokens
Happens to me too, trying to using "Graph Api Explorer" with an user id obtained debugging my application.
User id that obtain from a call as:
../<event_id>/likes
isn't REAL user id, but a kind of id "encrypted" (let me use the word) with access_token.
So if you wanna test that user id on GAE, you need to specify also access token:
https://graph.facebook.com/<user_id>?access_token=<application_access_token>
My campaign is running on FB and I want to extract daily data with the help of Ads API.
I'm using facebook ads api and I'm facing this problem every time
{
"error": {
"message": "(#294) Managing advertisements requires the extended permission ads_management, and a participating API key",
"type": "OAuthException",
"code": 294
}
}
I have created one app XYZ and using this created I created an ad campaign.
With Graph API Explorer I generated Access Token. and I give permissions also.
You have to make sure you have an application white listed to use the Ads API. Also, you need to make sure you get an access token for that white listed application. If your app is white listed, you can use the graph explorer, change the drop down to your app, click get access token and make sure you tick the ads_management permissions. Hope that helps.
You must have to extended permission for accessing facebook ads using api.
In your facebook application which one you created in facebook account .Add itme in status and review for ads_managemnt, insight.
Setting -> Status & Review -> Items in Review.
There are few way how to generate app access tokens in FB. If you want to access marketing api you should do this in page https://developers.facebook.com/apps/{YOUR_APP_ID}/marketing-api/tools/ using required options.