I try to add a ad account by graph API but alway error : "(#275) Cannot determine the target object for this request. Currently supported objects include ad account, business account and associated objects." . Help me , thanks so much
https://i.stack.imgur.com/lwU4p.png
Related
When I call the api:
graph.facebook.com/userid?fields=business_discovery.username(name){followers_count,media_count}
in Graph API explore, I got an invalid parameter error:
(#100) Tried accessing nonexisting field (business_discovery) on node type (User)
Could anyone please explain to me what I miss in the API url?
Thanks
This only works for Instagram Business Accounts, but you seem to be using it with a normal user id.
As https://developers.facebook.com/docs/instagram-api/reference/user/business_discovery says,
Instagram Platform API account IDs will not work with the new Instagram Graph API. Please use the Page node to determine the correct Instagram Business Account ID associated with the Facebook page.
You can not use this for other types of Instagram accounts, only for business accounts.
In my case the problem was that the instagram account was not connected to the page when the access-token was issue i.e. I added the instagram account after connecting the app.
So what worked for me was to remove the app, make sure that the instagram account is connected to the page the connect the app. Now the access token works.
My task is to get photo data of my business Instagram account with Instagram Graph API. I followed the instruction from Instagram Graph API -
https://developers.facebook.com/docs/instagram-api/reference/user/media
, which said request like
GET http://graph.facebook.com/17841405822304914/media
can get photo data from the Instagram account linked to the FB account in JSON format.
I tried to send GET request /my_facebook_id/media as said by the document with Graph API Explorer on FB developer platform but it failed to return the data I want.
This is the error I got:
message: Tried accessing nonexisting field (media) on node type (User)
type: OAuthException code: 100
Does the message mean the media field doesn't exist in the FB user?
What is the meanIng of error code 100? I can't even see that in FB official document.
I tried to use the Instagram business account ID for this request but I got an error message said the user object doesn't exist
How to get the task done? Thanks!
I guess you have missed creating a Facebook business page and linking your Instagram Business account to it.
Here is the guide to setup : https://developers.facebook.com/docs/instagram-api/getting-started
If this was done correctly and still you're facing the error is because of a Facebook bug where your account doesn't get linked correctly.
Here : https://developers.facebook.com/support/bugs/177912116363088/?disable_redirect=0
Solution : Please disconnect your Instagram account from your page. Then, on Instagram app, in setting you will have to switch back to personal account and reconvert to a business account
Note : Switching to a personal account you will lose the insights of your media.
Once this is done you should be able to get instagram_business_account and post which you can run your query to fetch the media :
GET http://graph.facebook.com/you-instagram-business-account-id/media
I have an Angular 5 app where I need to grab some data from my ad accounts via a Business Manager account that I have been made an admin of. I'm having trouble figuring out which API documentation I need to follow and which endpoints to call.
I'm just trying to figure out how to get data from the Graph API Explorer that Facebook provides and when I try something like this:
/v2.12/<business-account-id>/adaccounts I get an error:
{
"error": {
"message": "(#12) adaccounts field is deprecated for versions v2.11 and higher",
"type": "OAuthException",
"code": 12,
"fbtrace_id": "AV2JHORP+bN"
}
}
I have all the correct permissions set with my access token, though I'm not sure what to call to get that data. There are a lot of different API docs and I'm not sure which ones to follow.
Has anyone run into this as well?
I recently wrote a blog post explaining in-depth how to do this, and here is a brief overview:
Ad Accounts Owned by Your Business
To get the list of ad accounts that your Business account owns, you can make a call to the following URL:
/<API_VERSION>/<BUSINESS_ID>/owned_ad_accounts
Read more at: https://developers.facebook.com/docs/marketing-api/businessmanager/assets
Ad Accounts Owned by Your Clients
You can pull all ad accounts owned by other Business accounts by using the client_ad_accounts edge:
/<API_VERSION>/<BUSINESS_ID>/client_ad_accounts?fields=id,name,business
Requesting the business field will give you information about the Business that is sharing the ad account to you.
(Thanks to user skinnyas123 for reminding me about the new edge to get clients' ad accounts! I began using it awhile back and forgot to update this answer.)
I am using Facebook Ad Api to create ads. How ever when i grant a user Administrator Role (1001) with the following api call:
https://graph.facebook.com/v2.5/<AD_ACCOUNT_ID>/users?role=1001&uid=xxxxx
it successfully creates the user, and when i get all the users using the following request:
https://graph.facebook.com/v2.5/<AD_ACCOUNT_ID>/users
it successfully returns the array as:
"{"data":[{"name":"firstname lastname","permissions":[1,2,3,4,5,7],"role":1001,"id":"101xxxxxxxxxx352"}}"
but when i try to create an Ad campaign or Adset with the newly added user the following exception is thrown:
[FacebookAds\Http\Exception\AuthorizationException]
(#272) This Ads API call requires the user to be admin of the application. User 16xxxxx351 not admin or developer for application 109xxxxxxxx0403.
And when i go to my app and assign the user with an Administrator or Developer Role, I can make requests successfully.
Why is facebook not allowing a user created with administrator role from the api not make api calls to its Ad Api ? And why does it allow when the user is granted Administrator/Developer role make requests ?
This is because the objects you can promote are not based upon an adaccount but are based upon your user.
You can see the connection objects a user has access to by make the following request:
<API_VERSION>/act_<AD_ACCOUNT_ID>/connectionobjects?access_token=<ACCESS_TOKEN>
The documentation states:
this call returns the IDs of all objects for which the current session
user is an administrator, and the IDs of apps for which the user is
listed as a developer or advertiser.
If you don't want to make additional administrators for your app, you can create system user in Facebook Business Manager, grant him administrator (or even advertiser) rights for Ad Account.
https://developers.facebook.com/docs/marketing-api/business-manager-api
And use his token to manage ads. In my case I used it to retrieve targeting of ads, to find where leads came to lead form from.
https://www.facebook.com/marketingdevelopers/videos/vb.606699326111137/883648801749520/
I'm writing an application in C# that aims to query the Google Domain Shared Contacts API to retrieve (and eventually update/add/delete) all domain shared contact records. As this is not currently supported via the .NET client libraries, I have written a procedure to retrieve an oauth 2.0 token to include in my request to https://www.google.com/m8/feeds/contacts/example.com/full. I believe I have the oauth 2.0 token request procedure correct, but I am getting a 403 Forbidden error when calling the above mentioned URL with that token. However, if I go into the OAuth 2.0 playground and create a token through there and use that token instead in my C# app, the call succeeds and I get contact records returned.
My question is - does the Domain Shared Contacts API support being called with the credentials of a service account?
The solution to this issue was to include the email address of the "overarching" domain administrator account as the user being managed ('sub' property of claimset when creating Jason Web Token or 'User' property of ServiceAccountCredential initialization). As the domain administrator has access to all domain data, the call to retrieve all domain shared contacts now succeeds.