I am creating a Facebook app for providing insight into companies ad accounts, and I need to be able to have access to multiple accounts. Before I get started I want to make sure I can manage multiple companies Ad Accounts and report on them.
Do I need to use Facebook's "Ads Management API" along side of the "Ad Insights API"? And will either API provide multi account access?
Thank you
I know the Ads API allows you multi account access. For example, if you look at the Facebook Python SDK Readme, they give an example of using multiple accounts. I've included the relevant code below:
my_app_id = '<APP_ID>'
my_app_secret = '<APP_SECRET>'
my_access_token_1 = '<ACCESS_TOKEN_1>'
my_access_token_2 = '<ACCESS_TOKEN_2>'
session1 = FacebookSession(
my_app_id,
my_app_secret,
my_access_token_1,
)
session2 = FacebookSession(
my_app_id,
my_app_secret,
my_access_token_2,
)
api1 = FacebookAdsApi(session1)
api2 = FacebookAdsApi(session2)
Related
I'm developing integration with Google Ads API using their Ruby gem library.
I have an approved oAuth2 account for the Ads scope with an approved developer token that allows any external user to connect with our API.
I have a Google Ads account that manages our own Ads account and two other accounts.
When I authenticate with the API and approve it, I then grab the account with
graph = get_accounts_graph()
Apps::GoogleAds::Account.get_accounts_map(graph)
This surprisingly returns just ONE Ads account, and one that belongs to a client that we manage. Our own two Ads accounts are missing.
So I tried to compare between our client's account and our own.
Under https://ads.google.com/aw/accountaccess I can clearly see we have admin rights to our two ad accounts, just like we do to the client account.
Am I missing some setting somewhere? Has anyone experienced this before?
I ran into this issue at the beginning. The sample in the API client libraries (which I'm going to assume you are using here), calls the customer service
customer_service.list_accessible_customers()
There's actually two different services for retrieving customer account IDs. The customer service only allows access to accounts that are added as direct admins on each account. This is an important distinction as manager accounts don't fall into this category.
What you need to call is the regular GoogleAdsService (not the customer service!) and put your request in the query itself..
query = "SELECT customer_client_link.client_customer FROM customer_client_link"
This will give you a list of account IDs as resource names, not accessible accounts. And you can iterate over them as usual.
Hope that helps.
I created a new Service Account in Cloud Project, and want to restrict this account's permission to only use one specific Google API listed here.
Lets say my application using this service account should only be allowed to use "Google Analytics API". If possible, further limited to use subset of API requests (for ex. analytics.management.customMetrics.list, analytics.management.filters.insert etc.
I tried to create custom Role, but when I try to add necessary Permission, I don't see me desired permissions listed in that list... (attach screenshot)
How can I restrict this Service Account permissions to specific APIs?
Also,
does it make any difference creating new project in
https://console.developers.google.com/ or in
https://console.cloud.google.com/ ? I san see a project in both places
anyways...
In your case because you are using the Google Analytics API, there is an additional step where you need to add the Service Account to your Google Analytics account. If the Service Account is not added then it won't have access to the resources inside of Google Analytics.
See "1. Enable the API" in the following link:
https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/service-py
Add service account to the Google Analytics account
The newly created
service account will have an email address that looks similar to:
quickstart#PROJECT-ID.iam.gserviceaccount.com
Use this email address
to add a user to the Google analytics view you want to access via the
API. For this tutorial only Read & Analyze permissions are needed.
See the following for some guidance on managing users in Google Analytics
https://support.google.com/analytics/answer/1009702
I know that using the Google Cloud User Accounts API (https://developers.google.com/apis-explorer/#p/clouduseraccounts/beta/) it should be possible to enter a Project ID and obtain a list of user accounts associated with this.
Is there a GCP/Google API which does the opposite however and you can supply it with user (ID, email etc.) and it will list projects associated with this user?
I am not too familiar with GCP APIs so trial and error so far...
Thanks
The cloudresourcemanager.projects.list should be the API you're looking for: https://cloud.google.com/resource-manager/reference/rest/v1beta1/projects/list
API Explorer: https://developers.google.com/apis-explorer/#search/Resource/cloudresourcemanager/v1/cloudresourcemanager.projects.list
i am creating an app using google apis.i need to access user's documents through google apis using google admin account.In past i can use google docs api like this
for example i am admin of domain iritesh.com and my email address is ritesh#iritesh.com.i logged in using admin account and can retrieve documents in google drive of rajat#iritesh.com using user_id = rajat#iritesh.com.
https://docs.google.com/feeds/"+user_id+"/private/full/folder:root/contents?v=3&alt=json
but now google docs api's are deprecated.can anyone please guideline How to acheive this using google apis now.
link reference : https://developers.google.com/google-apps/documents-list/#using_google_apps_administrative_access_to_impersonate_other_domain_users
With the new API's and OAuth 2 you can accomplish this functionality but for it you will have to use Service account with domain wide delegation.
Basically with the service account it would be possible to impersonate users in the domain and make API calls in user's behalf. For getting information about documents you will use the Drive API.
Here is the documentation on service account:
https://developers.google.com/accounts/docs/OAuth2ServiceAccount
And Drive API:
https://developers.google.com/drive/v2/reference/
hope this helps.
I developed web application where I need to allow users to embed their google analytics dashboard. In order to access analytics dashboard I need client_id and service_email.
Is there a way to grab client_id and service_email using OAuth, I don't want to force users to manually create client_id so they can integrate dashboard.
Just to mention I'm using Laravel 4.
I get what's the issue here.
You actually have to set up a new project in https://console.developers.google.com. That is where you actually enable OAuth to Access Google Analytics API. The client_id and service_email you are referring to are actually the developer's one, which are accessible under Project > API & auth > Credentials in the Dashboard.
There's quite a lot to take in. I'll be available to clarify concepts for you.
References:
https://developers.google.com/accounts/docs/OAuth2
https://developers.google.com/console/help/new/