JavaScript Samples

39 views
Skip to first unread message

ghenne

unread,
Sep 21, 2011, 1:31:45 PM9/21/11
to adsen...@googlegroups.com
I'm not sure what "query the API from a backend" means if it is a web app. What kind of tricky SOAP stuff is there?

Perhaps off topic, we have been waiting almost 3 weeks for our AdSense approval. Is that normal? Is there a way to bump the process?


"We don't have JavaScript samples because in our experience SOAP usage

from JavaScript might be tricky, and it's usually easier to query the

API from a backend.


If you have any specific question about usage from JavaScript please

post it on the forum, I'll do my best to help you.


Cheers,

Silvano"

Silvano Luciani

unread,
Sep 22, 2011, 5:12:30 AM9/22/11
to AdSense API Forum
Hi,

I’m sorry my previous answer wasn’t clear enough, I’ll try to explain
with an example.

Let’s say that you have an application that displays a list of results
obtained querying the API. After some user activity, you need to
update the content of the list.
From the JavaScript/HTML frontend you make an asynchronous call to the
application backend, a server side application implemented in PHP,
Ruby, Python... The backend queries the API, formats the results and
returns the results to the JavaScript/HTML frontend that finally
updates the list on the page.

Regarding SOAP, there doesn’t seem to be a lot in the way of support
in Javascript, and what does exist has limited support. Most likely
you will end up having to handle the SOAP XML parsing and generation
yourself, as well as dealing with all of the authentication and error
handling manually. In addition, you’ll likely end up running into XSS
issues, given that your page and the web service you’re contacting are
not in the same domain. The only way of getting around those would be
to use a proxy page, in which case you’re better off doing all of the
SOAP requests server-side, as described on the paragraph above.

Cheers,
Silvano

--
Silvano Luciani | Developer Programs Engineer

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London
SW1W 9TQ
Registered in England Number: 3977902
Reply all
Reply to author
Forward
0 new messages