I'm trying to access Google Adwords Sandbox API and I cannot, for the life of me, figure out what's going on.
Here's my code:
var wsUrl = "https://adwords-sandbox.google.com/api/adwords/cm/v201008/CampaignService";
var soapRequest =
'<soapenv:Envelope \
xmlns:soapenv="http://schemax.xmlsoap.org/soap/envelope/" \
xmlns="https://adwords.google.com/api/adwords/cm/v200906"> \
<soapenv:Header> \
<service>adwords</service> \
<email>***@gmail.com</email> \
<password>***</password> \
<developerToken>***@gmail.com++USD</developerToken> \
<useragent>MyApplication</useragent> \
</soapenv:Header> \
<soapenv:Body> \
<getClientAccounts/> \
</soapenv:Body> \
</soapenv:Envelope>';
$.ajax({
type: "GET",
url: wsUrl,
contentType: document.body,
crossDomain: true,
dataType: "jsonp",
data: soapRequest,
success: processSuccess,
error: processError
});
});
function processSuccess(data, status, req) {
if (status == "success")
console.log("success");
}
function processError(data, status, req) {
console.log("status = " + status + " data= " + data );
}
I keep getting 500 Internal Server errors. What am I doing wrong?! On the Google Adwords Sandbox website, they list simple instructions:
To create a sandbox account, send a get request to the sandbox version of CampaignService, using the WSDL location and sandbox headers as described below. This initial call to the sandbox creates an MCC sandbox account, along with five client accounts, for the email address you specified. Your sandbox account and its client accounts start out empty. http://code.google.com/apis/adwords/docs/sandbox.html
Help!
<meta content-type="application/soap+xml">
to the head body? it didn't make any difference unfortunately – jnfr