Any Sample Code for Java Web Application to Use AdSense API?

53 views
Skip to first unread message

Tianyi Cong

unread,
Apr 8, 2015, 12:46:15 PM4/8/15
to adsen...@googlegroups.com
Hi All,

I have a java web application and I'd to use AdSense management API to retrieve reports but I am stuck at the authorization part.

Seems it requires OAuth2. I looked the sample code from this github URL, but seems it is for AuthorizationCodeInstalledApp.

Is there a sample code I can take a look at for a java web application? Please share some code or ideas with me if you are familiar with this process.

Thanks in advance!

Dean Lukies (Adsense API Team)

unread,
Apr 8, 2015, 1:20:23 PM4/8/15
to adsen...@googlegroups.com
Hi Tlanyl,

we don't have java web specific example.

You could take a look at the OAuth2 page and maybe the PHP sample for guidance.

thanks,
Dean

Tianyi Cong

unread,
Apr 9, 2015, 1:15:11 PM4/9/15
to adsen...@googlegroups.com
Hi Dean,

Thanks for the reply, is that means I can do the web service call the get the token for authentication instead of using the java api? That may be simpler, seems like.

I also want to persist this authentication, so me and my partners don't have to do it every time they want to check the report. I found some thread in the forum, but it is not very clear. 

Can you please elaborate the process to achieve this? Can I just persist that token, or it will expire after a certain amount of time and I have to swtich to another one? If so, can it be done grammatically instead?

Thanks,
Tianyi
Message has been deleted

Dean Lukies (Adsense API Team)

unread,
Apr 10, 2015, 10:40:15 AM4/10/15
to adsen...@googlegroups.com
Hi Tianyi,

the tokens last a long time (I don't have specifics but months+)

you could try doing it yourself without the client but it is non-trivial - take a look at the PHP example which uses helper methods - we don't have examples or a guide for doing that.

thanks,
Dean
Reply all
Reply to author
Forward
0 new messages