How to start using a simple adwords campaign creation using java?

121 views
Skip to first unread message

Gitaaab

unread,
Sep 26, 2014, 10:49:08 AM9/26/14
to adwor...@googlegroups.com
Hi,
i have a adwords account to test campaign creation etc...
I can create them using my adwords account directly.
What i want now is to create adwords campaign using java.

and i used the code AddCampaign.java

When i run this code from Netbeans, i have the following error:
javax.xml.rpc.ServiceException: Could not get ClientLogin token for user: Auth token could not be retrieved because of error: BadAuthentication
    at com.google.api.adwords.lib.AdWordsVersion$AdWordsVersionV201309.setHeaders(AdWordsVersion.java:147)
    at com.google.api.adwords.lib.AdWordsServiceFactory.getConfiguredStub(AdWordsServiceFactory.java:168)
    at com.google.api.adwords.lib.AdWordsServiceFactory.generateServiceStub(AdWordsServiceFactory.java:97)
    at com.google.api.adwords.lib.AdWordsUser.getService(AdWordsUser.java:215)
    at adwords.AddCampaign.main(AddCampaign.java:49)

In my properties files i have:
email=myemailaddress
password=mypassword
clientId=000-000-0000 //here i put my Customer ID?
useragent=INSERT_COMPANY_NAME //shoukd i fill this?
developerToken=INSERT_DEVELOPER_TOKEN_HERE // Where can i get this?
partialFailure=false
returnMoneyInMicros=false
Please help to begin.
Thank you very much

Josh Radcliff (AdWords API Team)

unread,
Sep 26, 2014, 12:35:16 PM9/26/14
to adwor...@googlegroups.com
Hi,

The client library you are using is quite outdated. Please use the latest version on github here:


The README and OAuth2 guide are good places to start. The latter explains what you need to place in your properties file, and how to generate the OAuth credentials you'll need.

Cheers,
Josh, AdWords API Team

Gitaaab

unread,
Sep 27, 2014, 5:01:17 PM9/27/14
to adwor...@googlegroups.com
Thank you for your help,

so i followed instructions in OAuth2 guide an di dowloaded this file;
adwords-axis-jars-and-examples-1.33.0
Then open this file:
ads.properties

here i have to fill:
api.adwords.refreshToken=INSERT_REFERSH_TOKEN_HERE
api.adwords.clientId=
pi.adwords.clientSecret=INSERT_CLIENT_SECRET_HERE
api.adwords.clientCustomerId=INSERT_CLIENT_CUSTOMER_ID_HERE
pi.adwords.userAgent=INSERT_USERAGENT_HERE
api.adwords.developerToken=INSERT_DEVELOPER_TOKEN_HERE

I have only these information from https://console.developers.google.com/project/seraphic-hawk-715/apiui/credential
Client ID
Email address
Public key fingerprints

How can i find the other values?
Thank you

Josh Radcliff (AdWords API Team)

unread,
Sep 29, 2014, 9:31:08 AM9/29/14
to adwor...@googlegroups.com
Hi,

The OAuth2 guide I mentioned in my previous post contain instructions on how to set most of those values (clientId, clientSecret, refreshToken). For the other values, please see the descriptions here.

Thanks,
Josh, AdWords API Team
Reply all
Reply to author
Forward
0 new messages