GetKeywordIdeas 服务操作 - Ad Insight

获取关键字 (keyword) 想法的列表。

根据现有关键字、网站和产品类别建议新的广告组和关键字。 还可以请求关键字的历史统计信息,例如每月搜索、竞争、平均 CPC 和广告印象份额。 可以使用返回的建议关键字 (keyword) 出价作为 GetKeywordTrafficEstimates 操作的输入。

提示

有关概述,请参阅 关键字创意和流量估算 技术指南。

请求元素

GetKeywordIdeasRequest 对象定义服务操作请求的正文标头元素。 元素的顺序必须与 请求 SOAP 中所示的顺序相同。

注意

除非下面另有说明,否则需要所有请求元素。

请求正文元素

元素 说明 数据类型
ExpandIdeas 确定是需要新关键字 (keyword) 创意,还是仅需要搜索搜索参数列表中指定的关键字集关键字 (keyword) 属性。 如果将此元素设置为 false,则 QuerySearchParameter 对象必须包含在 SearchParameters 列表中。 boolean
IdeaAttributes 要包含在响应中的关键字 (keyword) idea 属性,例如 KeywordCompetitionMonthlySearchCountsSuggestedBid

竞赛属性是必需的。

将始终为每个返回的 KeywordIdea 返回 Keyword 属性,无论你是否在请求的想法属性列表中包含 Keyword 值。
KeywordIdeaAttribute 数组
SearchParameters 搜索参数定义所请求关键字 (keyword) 想法的条件和筛选器。

不要尝试实例化 SearchParameter。 可以包括派生自它的一个或多个对象: CategorySearchParameterCompetitionSearchParameterDateRangeSearchParameterDeviceSearchParameterExcludeAccountKeywordsSearchParameterIdeaTextSearchParameterImpressionShareSearchParameterLanguageSearchParameterLocationSearchParameterNetworkSearchParameterQuerySearchParameterSearchVolumeSearchParameterSuggestedBidSearchParameterUrlSearchParameter。 从 SearchParameter 派生的其他对象对此操作无效。

不能包含任何搜索参数类型的重复项。

该列表必须包括所有这些搜索参数: LanguageSearchParameterLocationSearchParameterNetworkSearchParameter

列表必须包括一个或多个以下搜索参数: CategorySearchParameterQuerySearchParameterUrlSearchParameter。 如果 ExpandIdeas 元素为 false,则无论是否包含其他搜索参数,都需要 QuerySearchParameter

上一个日历月的数据最多可能需要 72 小时才能可用。 例如,如果在 8 月 1 日、2 日或 3 日请求关键字 (keyword) 想法,并且 7 月的数据尚未准备就绪,则响应将基于 6 月的数据。 如果未在 GetKeywordIdeas 请求中包含 DateRangeSearchParameter,则无法确认第一个列表项是前一个月还是上个月的数据。 如果指定了日期范围,并且最近一个月的数据尚不可用,则 GetKeywordIdeas 将返回错误。
SearchParameter 数组

请求标头元素

元素 说明 数据类型
AuthenticationToken OAuth 访问令牌,表示有权Microsoft广告帐户的用户的凭据。

有关详细信息,请参阅 使用 OAuth 进行身份验证
string
CustomerAccountId 拥有或与请求中的实体关联的广告帐户的标识符。 如果需要这两个元素,此标头元素必须与 AccountId 正文元素具有相同的值。 此元素是大多数服务操作所必需的,作为最佳做法,应始终设置它。

有关详细信息,请参阅 获取帐户和客户 ID
string
CustomerId 用户正在访问或操作的客户) 经理帐户 (标识符。 用户可以访问多个经理帐户。 此元素是大多数服务操作所必需的,作为最佳做法,应始终设置它。

有关详细信息,请参阅 获取帐户和客户 ID
string
DeveloperToken 用于访问必应广告 API 的开发人员令牌。

有关详细信息,请参阅 获取开发人员令牌
string
Password 此元素保留供内部使用,将从 API 的未来版本中删除。 必须使用 AuthenticationToken 元素来设置用户凭据。 string
UserName 此元素保留供内部使用,将从 API 的未来版本中删除。 必须使用 AuthenticationToken 元素来设置用户凭据。 string

响应元素

GetKeywordIdeasResponse 对象定义服务操作响应的正文标头元素。 元素的返回顺序与 响应 SOAP 中所示的顺序相同。

响应正文元素

元素 说明 数据类型
KeywordIdeas 关键字 (keyword) 想法的列表。

目前,最多可以返回 3,000 个列表项,但限制可能会更改。
KeywordIdea 数组

响应标头元素

元素 说明 数据类型
跟踪 ID 包含 API 调用详细信息的日志条目的标识符。 string

请求 SOAP

此模板由一个工具生成,用于显示 SOAP 请求的正文标头元素的顺序。 有关可用于此服务操作的支持类型,请参阅上面的 请求正文元素 参考。

<s:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns="https://bingads.microsoft.com/AdInsight/v13">
    <Action mustUnderstand="1">GetKeywordIdeas</Action>
    <AuthenticationToken i:nil="false">ValueHere</AuthenticationToken>
    <CustomerAccountId i:nil="false">ValueHere</CustomerAccountId>
    <CustomerId i:nil="false">ValueHere</CustomerId>
    <DeveloperToken i:nil="false">ValueHere</DeveloperToken>
  </s:Header>
  <s:Body>
    <GetKeywordIdeasRequest xmlns="https://bingads.microsoft.com/AdInsight/v13">
      <ExpandIdeas i:nil="false">ValueHere</ExpandIdeas>
      <IdeaAttributes i:nil="false">
        <KeywordIdeaAttribute>ValueHere</KeywordIdeaAttribute>
      </IdeaAttributes>
      <SearchParameters i:nil="false">
        <SearchParameter i:type="-- derived type specified here with the appropriate prefix --">
          <!--This field is applicable if the derived type attribute is set to QuerySearchParameter-->
          <Queries i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:string>ValueHere</a1:string>
          </Queries>
          <!--This field is applicable if the derived type attribute is set to UrlSearchParameter-->
          <Url i:nil="false">ValueHere</Url>
          <!--This field is applicable if the derived type attribute is set to CategorySearchParameter-->
          <CategoryId>ValueHere</CategoryId>
          <!--These fields are applicable if the derived type attribute is set to SearchVolumeSearchParameter-->
          <Maximum i:nil="false">ValueHere</Maximum>
          <Minimum i:nil="false">ValueHere</Minimum>
          <!--These fields are applicable if the derived type attribute is set to SuggestedBidSearchParameter-->
          <Maximum i:nil="false">ValueHere</Maximum>
          <Minimum i:nil="false">ValueHere</Minimum>
          <!--These fields are applicable if the derived type attribute is set to IdeaTextSearchParameter-->
          <Excluded i:nil="false">
            <Keyword>
              <Id i:nil="false">ValueHere</Id>
              <MatchType>ValueHere</MatchType>
              <Text i:nil="false">ValueHere</Text>
            </Keyword>
          </Excluded>
          <Included i:nil="false">
            <Keyword>
              <Id i:nil="false">ValueHere</Id>
              <MatchType>ValueHere</MatchType>
              <Text i:nil="false">ValueHere</Text>
            </Keyword>
          </Included>
          <!--This field is applicable if the derived type attribute is set to ExcludeAccountKeywordsSearchParameter-->
          <ExcludeAccountKeywords>ValueHere</ExcludeAccountKeywords>
          <!--These fields are applicable if the derived type attribute is set to ImpressionShareSearchParameter-->
          <Maximum i:nil="false">ValueHere</Maximum>
          <Minimum i:nil="false">ValueHere</Minimum>
          <!--This field is applicable if the derived type attribute is set to LocationSearchParameter-->
          <Locations i:nil="false">
            <LocationCriterion>
              <LocationId>ValueHere</LocationId>
            </LocationCriterion>
          </Locations>
          <!--This field is applicable if the derived type attribute is set to NetworkSearchParameter-->
          <Network i:nil="false">
            <Network>ValueHere</Network>
          </Network>
          <!--This field is applicable if the derived type attribute is set to DeviceSearchParameter-->
          <Device i:nil="false">
            <DeviceName i:nil="false">ValueHere</DeviceName>
          </Device>
          <!--This field is applicable if the derived type attribute is set to LanguageSearchParameter-->
          <Languages i:nil="false">
            <LanguageCriterion>
              <Language i:nil="false">ValueHere</Language>
            </LanguageCriterion>
          </Languages>
          <!--This field is applicable if the derived type attribute is set to CompetitionSearchParameter-->
          <CompetitionLevels i:nil="false">
            <CompetitionLevel>ValueHere</CompetitionLevel>
          </CompetitionLevels>
          <!--These fields are applicable if the derived type attribute is set to DateRangeSearchParameter-->
          <EndDate i:nil="false">
            <Day>ValueHere</Day>
            <Month>ValueHere</Month>
            <Year>ValueHere</Year>
          </EndDate>
          <StartDate i:nil="false">
            <Day>ValueHere</Day>
            <Month>ValueHere</Month>
            <Year>ValueHere</Year>
          </StartDate>
        </SearchParameter>
      </SearchParameters>
    </GetKeywordIdeasRequest>
  </s:Body>
</s:Envelope>

响应 SOAP

此模板由一个工具生成,用于显示 SOAP 响应的 正文标头 元素的顺序。

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns="https://bingads.microsoft.com/AdInsight/v13">
    <TrackingId d3p1:nil="false" xmlns:d3p1="http://www.w3.org/2001/XMLSchema-instance">ValueHere</TrackingId>
  </s:Header>
  <s:Body>
    <GetKeywordIdeasResponse xmlns="https://bingads.microsoft.com/AdInsight/v13">
      <KeywordIdeas d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
        <KeywordIdea>
          <AdGroupId d4p1:nil="false">ValueHere</AdGroupId>
          <AdGroupName d4p1:nil="false">ValueHere</AdGroupName>
          <AdImpressionShare d4p1:nil="false">ValueHere</AdImpressionShare>
          <Competition d4p1:nil="false">ValueHere</Competition>
          <Keyword d4p1:nil="false">ValueHere</Keyword>
          <MonthlySearchCounts d4p1:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:long>ValueHere</a1:long>
          </MonthlySearchCounts>
          <Relevance d4p1:nil="false">ValueHere</Relevance>
          <Source d4p1:nil="false">ValueHere</Source>
          <SuggestedBid d4p1:nil="false">ValueHere</SuggestedBid>
        </KeywordIdea>
      </KeywordIdeas>
    </GetKeywordIdeasResponse>
  </s:Body>
</s:Envelope>

代码语法

示例语法可用于 必应广告 SDK。 有关更多示例,请参阅 必应广告 API 代码示例

public async Task<GetKeywordIdeasResponse> GetKeywordIdeasAsync(
	bool? expandIdeas,
	IList<KeywordIdeaAttribute> ideaAttributes,
	IList<SearchParameter> searchParameters)
{
	var request = new GetKeywordIdeasRequest
	{
		ExpandIdeas = expandIdeas,
		IdeaAttributes = ideaAttributes,
		SearchParameters = searchParameters
	};

	return (await AdInsightService.CallAsync((s, r) => s.GetKeywordIdeasAsync(r), request));
}
static GetKeywordIdeasResponse getKeywordIdeas(
	boolean expandIdeas,
	ArrayOfKeywordIdeaAttribute ideaAttributes,
	ArrayOfSearchParameter searchParameters) throws RemoteException, Exception
{
	GetKeywordIdeasRequest request = new GetKeywordIdeasRequest();

	request.setExpandIdeas(expandIdeas);
	request.setIdeaAttributes(ideaAttributes);
	request.setSearchParameters(searchParameters);

	return AdInsightService.getService().getKeywordIdeas(request);
}
static function GetKeywordIdeas(
	$expandIdeas,
	$ideaAttributes,
	$searchParameters)
{

	$GLOBALS['Proxy'] = $GLOBALS['AdInsightProxy'];

	$request = new GetKeywordIdeasRequest();

	$request->ExpandIdeas = $expandIdeas;
	$request->IdeaAttributes = $ideaAttributes;
	$request->SearchParameters = $searchParameters;

	return $GLOBALS['AdInsightProxy']->GetService()->GetKeywordIdeas($request);
}
response=adinsight_service.GetKeywordIdeas(
	ExpandIdeas=ExpandIdeas,
	IdeaAttributes=IdeaAttributes,
	SearchParameters=SearchParameters)

要求

服务: AdInsightService.svc v13
命名空间: https://bingads.microsoft.com/AdInsight/v13

请求 URL

https://adinsight.api.bingads.microsoft.com/AdInsight/v13/KeywordIdeas/Query

请求元素

GetKeywordIdeasRequest 对象定义服务操作请求的正文标头元素。

注意

除非下面另有说明,否则需要所有请求元素。

请求正文元素

元素 说明 数据类型
ExpandIdeas 确定是需要新关键字 (keyword) 创意,还是仅需要搜索搜索参数列表中指定的关键字集关键字 (keyword) 属性。 如果将此元素设置为 false,则 QuerySearchParameter 对象必须包含在 SearchParameters 列表中。 boolean
IdeaAttributes 要包含在响应中的关键字 (keyword) idea 属性,例如 KeywordCompetitionMonthlySearchCountsSuggestedBid

竞赛属性是必需的。

将始终为每个返回的 KeywordIdea 返回 Keyword 属性,无论你是否在请求的想法属性列表中包含 Keyword 值。
KeywordIdeaAttribute 数组
SearchParameters 搜索参数定义所请求关键字 (keyword) 想法的条件和筛选器。

不要尝试实例化 SearchParameter。 可以包括派生自它的一个或多个对象: CategorySearchParameterCompetitionSearchParameterDateRangeSearchParameterDeviceSearchParameterExcludeAccountKeywordsSearchParameterIdeaTextSearchParameterImpressionShareSearchParameterLanguageSearchParameterLocationSearchParameterNetworkSearchParameterQuerySearchParameterSearchVolumeSearchParameterSuggestedBidSearchParameterUrlSearchParameter。 从 SearchParameter 派生的其他对象对此操作无效。

不能包含任何搜索参数类型的重复项。

该列表必须包括所有这些搜索参数: LanguageSearchParameterLocationSearchParameterNetworkSearchParameter

列表必须包括一个或多个以下搜索参数: CategorySearchParameterQuerySearchParameterUrlSearchParameter。 如果 ExpandIdeas 元素为 false,则无论是否包含其他搜索参数,都需要 QuerySearchParameter

上一个日历月的数据最多可能需要 72 小时才能可用。 例如,如果在 8 月 1 日、2 日或 3 日请求关键字 (keyword) 想法,并且 7 月的数据尚未准备就绪,则响应将基于 6 月的数据。 如果未在 GetKeywordIdeas 请求中包含 DateRangeSearchParameter,则无法确认第一个列表项是前一个月还是上个月的数据。 如果指定了日期范围,并且最近一个月的数据尚不可用,则 GetKeywordIdeas 将返回错误。
SearchParameter 数组

请求标头元素

元素 说明 数据类型
Authorization OAuth 访问令牌,表示有权Microsoft广告帐户的用户的凭据。 请确保令牌的前缀为“持有者”,这是正确身份验证所必需的。

有关详细信息,请参阅 使用 OAuth 进行身份验证
string
CustomerAccountId 拥有或与请求中的实体关联的广告帐户的标识符。 如果需要这两个元素,此标头元素必须与 AccountId 正文元素具有相同的值。 此元素是大多数服务操作所必需的,作为最佳做法,应始终设置它。

有关详细信息,请参阅 获取帐户和客户 ID
string
CustomerId 用户正在访问或操作的客户) 经理帐户 (标识符。 用户可以访问多个经理帐户。 此元素是大多数服务操作所必需的,作为最佳做法,应始终设置它。

有关详细信息,请参阅 获取帐户和客户 ID
string
DeveloperToken 用于访问必应广告 API 的开发人员令牌。

有关详细信息,请参阅 获取开发人员令牌
string
Password 此元素保留供内部使用,将从 API 的未来版本中删除。 必须使用 AuthenticationToken 元素来设置用户凭据。 string
UserName 此元素保留供内部使用,将从 API 的未来版本中删除。 必须使用 AuthenticationToken 元素来设置用户凭据。 string

响应元素

GetKeywordIdeasResponse 对象定义服务操作响应的正文标头元素。 元素的返回顺序与 响应 JSON 中所示的顺序相同。

响应正文元素

元素 说明 数据类型
KeywordIdeas 关键字 (keyword) 想法的列表。

目前,最多可以返回 3,000 个列表项,但限制可能会更改。
KeywordIdea 数组

响应标头元素

元素 说明 数据类型
跟踪 ID 包含 API 调用详细信息的日志条目的标识符。 string

请求 JSON

此模板由显示 JSON 请求的 正文标头 元素的工具生成。 有关可用于此服务操作的支持类型,请参阅上面的 请求正文元素 参考。

{
  "ExpandIdeas": "ValueHere",
  "IdeaAttributes": [
    "ValueHere"
  ],
  "SearchParameters": [
    {
      "Queries": {
        "string": "ValueHere"
      },
      "Url": "ValueHere",
      "CategoryId": "ValueHere",
      "Maximum": [
        "ValueHere",
        "ValueHere",
        "ValueHere"
      ],
      "Minimum": [
        "ValueHere",
        "ValueHere",
        "ValueHere"
      ],
      "Excluded": {
        "Keyword": {
          "Id": "ValueHere",
          "MatchType": "ValueHere",
          "Text": "ValueHere"
        }
      },
      "Included": {
        "Keyword": {
          "Id": "ValueHere",
          "MatchType": "ValueHere",
          "Text": "ValueHere"
        }
      },
      "ExcludeAccountKeywords": "ValueHere",
      "Locations": {
        "LocationCriterion": {
          "LocationId": "ValueHere"
        }
      },
      "Network": {
        "Network": "ValueHere"
      },
      "Device": {
        "DeviceName": "ValueHere"
      },
      "Languages": {
        "LanguageCriterion": {
          "Language": "ValueHere"
        }
      },
      "CompetitionLevels": {
        "CompetitionLevel": "ValueHere"
      },
      "EndDate": {
        "Day": "ValueHere",
        "Month": "ValueHere",
        "Year": "ValueHere"
      },
      "StartDate": {
        "Day": "ValueHere",
        "Month": "ValueHere",
        "Year": "ValueHere"
      }
    }
  ]
}

响应 JSON

此模板由一个工具生成,用于显示 JSON 响应的 正文标头 元素。

{
  "KeywordIdeas": [
    {
      "AdGroupId": "LongValueHere",
      "AdGroupName": "ValueHere",
      "AdImpressionShare": DoubleValueHere,
      "Competition": "ValueHere",
      "Keyword": "ValueHere",
      "MonthlySearchCounts": [
        "LongValueHere"
      ],
      "Relevance": DoubleValueHere,
      "Source": "ValueHere",
      "SuggestedBid": DoubleValueHere
    }
  ]
}

代码语法

若要通过 SDK 调用 REST API,需要将 SDK 升级到特定版本并配置系统参数。示例语法可用于 必应广告 SDK。 有关更多示例,请参阅 必应广告 API 代码示例

public async Task<GetKeywordIdeasResponse> GetKeywordIdeasAsync(
	bool? expandIdeas,
	IList<KeywordIdeaAttribute> ideaAttributes,
	IList<SearchParameter> searchParameters)
{
	var request = new GetKeywordIdeasRequest
	{
		ExpandIdeas = expandIdeas,
		IdeaAttributes = ideaAttributes,
		SearchParameters = searchParameters
	};

	return (await AdInsightService.CallAsync((s, r) => s.GetKeywordIdeasAsync(r), request));
}
static GetKeywordIdeasResponse getKeywordIdeas(
	boolean expandIdeas,
	ArrayOfKeywordIdeaAttribute ideaAttributes,
	ArrayOfSearchParameter searchParameters) throws RemoteException, Exception
{
	GetKeywordIdeasRequest request = new GetKeywordIdeasRequest();

	request.setExpandIdeas(expandIdeas);
	request.setIdeaAttributes(ideaAttributes);
	request.setSearchParameters(searchParameters);

	return AdInsightService.getService().getKeywordIdeas(request);
}
static function GetKeywordIdeas(
	$expandIdeas,
	$ideaAttributes,
	$searchParameters)
{

	$GLOBALS['Proxy'] = $GLOBALS['AdInsightProxy'];

	$request = new GetKeywordIdeasRequest();

	$request->ExpandIdeas = $expandIdeas;
	$request->IdeaAttributes = $ideaAttributes;
	$request->SearchParameters = $searchParameters;

	return $GLOBALS['AdInsightProxy']->GetService()->GetKeywordIdeas($request);
}
response=adinsight_service.GetKeywordIdeas(
	ExpandIdeas=ExpandIdeas,
	IdeaAttributes=IdeaAttributes,
	SearchParameters=SearchParameters)