发现Google Adwords Api错误无效内容

时间:2017-07-12 15:35:29

标签: node.js soap google-adwords

我正在使用针对Google adwords Api的nodejs包,我收到以下错误:

'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Unmarshalling Error: cvc-complex-type.2.4.a
: Invalid content was found starting with element \'serviceSelector\'. One of \'{"https://adwords.google.com/api/adwords/o/v201609":selector}\' is expected. </faultstring></soap:Fault></soap:B
ody></soap:Envelope>' }

我正在尝试获取关键字提示。我的代码如下所示:

var TargetingIdeaService = user.getService('TargetingIdeaService', 'v201609')

//create selector 
var selector = {
    SearchParameter:{[RelatedToQuerySearchParameter:'Test']},
    IdeaType:'KEYWORDS',
    requestType:'IDEAS',
    requestedAttributeTypes: ['TARGETED_MONTHLY_SEARCHES'],
    paging: {startIndex: 0, numberResults: AdwordsConstants.RECOMMENDED_PAGE_SIZE}
}

TargetingIdeaService.get({serviceSelector: selector}, function (error, result) {
    console.log(error, result);
}) 

提前感谢任何有关为什么不起作用的想法。

使用此文档:

https://developers.google.com/adwords/api/docs/reference/v201609/TargetingIdeaService

1 个答案:

答案 0 :(得分:0)

get来电所需的参数是selector,而不是serviceSelector

另外,我注意到您链接到旧版API文档 - 请注意v201609已被弃用,并将于2017年10月2日落日。这里是{{{{ 3}}