我正在尝试使用Google脚本从Bing Ads帐户访问每月支出金额(我正在尝试将数据放入电子表格中)。我感兴趣的SOAP端点如下:http://msdn.microsoft.com/en-US/library/dn451264.aspx。
我的代码目前(敏感数据已被替换):
function bing() {
var wsdlURL = "https://clientcenter.api.bingads.microsoft.com/Api/Billing/v9/CustomerBillingService.svc?singleWsdl";
var wsdl = SoapService.wsdl(wsdlURL);
var header = [
Xml.element("ApplicationToken", [""]),
Xml.element("AuthenticationToken", [""]),
Xml.element("UserName", ["username"]),
Xml.element("Password", ["password"]),
Xml.element("DeveloperToken", ["token"])];
var billingService = wsdl.getCustomerBillingService();
var param = Xml.element("GetAccountMonthlySpendRequest", [
Xml.attribute("xmlns", "https://bingads.microsoft.com/Billing/v9"),
Xml.element("AccountId", [
"accountID"
]),
Xml.element("MonthYear", [
"2014-05"
])
]);
Logger.log(param);
Logger.log(header);
var envelope = billingService.getSoapEnvelope("GetAccountMonthlySpend", param, header)
Logger.log(envelope);
var result = billingService.GetAccountMonthlySpend(param, header);
Logger.log(result);
}
这几乎生成一个与doucumentation相同但但不完全的信封,当我运行脚本时,我得到500错误。使用SoapService
是访问此数据的最佳方式吗?可以修改以上内容吗?
谢谢!