Here's a test program I wrote. You can indeed call the Google AdWordsAPI from JavaScript...
function postData(Url, Data, Action) {
var oHttpReq = new ActiveXObject("Msxml2.XMLHTTP.4.0");
oHttpReq.open("POST", Url, false);
oHttpReq.setRequestHeader("Man", "POST" + Url + "HTTP/1.1");
oHttpReq.setRequestHeader("MessageType", "CALL");
oHttpReq.setRequestHeader("Content-Type", "text/xml");
oHttpReq.setRequestHeader("SOAPACtion", Action);
oHttpReq.send(Data);
return oHttpReq;
}
function main() {
var sUrl = "https://adwords.google.com/api/adwords/v2";
var sData = ' <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns="https://adwords.google.com/api/adwords/v2">
<soap:Header>
<email>EMAIL HERE</email>
<password>YOUR PASSWORD</password>
<useragent>XXX</useragent>
<token>YOUR TOKEN</token>
<clientEmail></clientEmail>
</soap:Header>
<soap:Body>
<getOperationCount>
<startdate>2005-01-02T23:59:59</startdate><enddate>2005-02-02T23:59:59</enddate>
</getOperationCount></soap:Body></soap:Envelope>';
var oResponse = postData(sUrl, sData, "getOperationCount");
if (oResponse.status == 200) {
WScript.echo(oResponse.responseText);
} else {
WScript.echo("Could not retrieve data:\n" + oResponse.statusText + " (" + oResponse.status + ")");
}
oHttpReq = null;
}
main();