Hi,
Thanks for reaching out to the Google Ads API Support. I had to delete your initial post as it contained your Cloud Project ID. I am reposting below without the sensitive information for reference :
"Hi Support,
We are trying to migrate our application from AdWords API to Google Ads. We follow the wiki: Migration. and download the sample code.
Then follow below steps:
1. create ads.properties in my home directory, fill all the required fields like clientSecret, developerToken etc
2. cd google-ads-examples
3. run mvn exec:java -Dexec.mainClass="com.google.ads.googleads.examples.basicoperations.GetCampaigns" \
-Dexec.args="--customerId INSERT_CUSTOMER_ID_HERE"
I passed one customerId which we use in current AdWords version, but it reported error:
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project google-ads-examples: An exception occured while executing the Java class. io.grpc.StatusRuntimeException: PERMISSION_DENIED: Google Ads API has not been used in project <Project ID> before or it is disabled. Enable it by visiting <your cloud project> then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry. -> [Help 1]
Could you help me find the root cause? Meanwhile i also have no access to access the website in error message.
Another question is, There is one file called ads.properties.sample in the Sample Java Project, i saw it has one config called api.googleads.loginCustomerId, what does it mean? is it mandatory to run the App? I try to comment or add that field in my ads.properties file, but nothing helps. still no permission issue reported.
Thank you for your help and support!"
Upon checking the error log you’ve provided with us, it seems that you’ve received a “PERMISSION_DENIED” error due to Google Ads API disabled in your cloud console. If you haven't yet, you would need to enable the Google Ads API on the corresponding GCP project using the cloud console.
For your other concern regarding the loginCustomerid, as for the login-customer-id, to elaborate more, if your access to the customer account is through a manager account (OAuth2 credentials created using a user that has access to your manager account), this header is required and must be set to the customer ID of the manager account. You will then need to specify this in your ads.properties file, where your other credentials are placed.
To fetch the user customer id based on their credentials, you could use CustomerService.ListAccessibleCustomers via the Google Ads API to achieve it if the user authenticates with their manager account. However, if this does not work, please try to use CustomerService.getCustomers() via the AdWords API to fetch the user customer id.
In addition, please refrain from posting personal information to public channels like this public forum for security purposes.
Hope this helps. Let us know if you have any further questions.
Regards,
|
||||||