此 API 有其他语言版本,但我想要 Node.JS 中的代码。
最佳答案
来源:https://developers.google.com/adwords/api/docs/guides/targeting-idea-service#python_4
看起来你必须发送一个 POST 请求,问题是请求是从 targetingIdeaService.get function 构建的:
targetingIdeaService.get(selector)
选择器本身可以从文档中猜到:
offset = 0
PAGE_SIZE = 10
selector = {
'ideaType': 'KEYWORD',
'requestType': 'IDEAS',
'requestedAttributeTypes':[
'KEYWORD_TEXT',
'SEARCH_VOLUME',
'CATEGORY_PRODUCTS_AND_SERVICES'
],
'paging':{
'startIndex': str(offset),
'numberResults': str(PAGE_SIZE)
},
'searchParameters':[{
'xsi_type': 'RelatedToQuerySearchParameter',
'queries': ['space cruise']
}]
}
但是您无权访问从该对象构造请求的方式。
我建议您使用 this unofficial googleads node library因为它似乎可以处理 targetingIdeaService
。甚至 this npm package因为它有更多的最新发展。
关于node.js - 如何在 Node.JS 中获取 TargetingIdeaSelector API(用于获取关键字搜索数据的 Google API)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62180861/