RetrieveRecommendations 服务操作 - Ad Insight

检索建议列表。

请求元素

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

注意

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

请求正文元素

元素 说明 数据类型
MaxCount 返回的建议的最大数目。 默认值为 null。 如果 MaxCount 为 null 或 0,则返回所有可用建议。 可选。 int
RecommendationTypes 建议类型名称:ADD_BROAD_MATCH_KEYWORD、CAMPAIGN_BUDGET、KEYWORD、REMOVE_CONFLICTING_NEGATIVE_KEYWORD、RESPONSIVE_SEARCH_AD或RESPONSIVE_SEARCH_AD_ASSET。 必填。 字符串 数组

请求标头元素

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

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

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

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

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

响应元素

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

响应正文元素

元素 说明 数据类型
建议 特定帐户 ID 的可用建议。 建议的类型包括: AddBroadMatchKeywordRecommendationCampaignBudgetRecommendationKeywordRecommendationRemoveConflictingNegativeKeywordRecommendationResponsiveSearchAdRecommendationResponsiveSearchAdAssetRecommendation RecommendationBase 数组

响应标头元素

元素 说明 数据类型
跟踪 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">RetrieveRecommendations</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>
    <RetrieveRecommendationsRequest xmlns="https://bingads.microsoft.com/AdInsight/v13">
      <RecommendationTypes i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <a1:string>ValueHere</a1:string>
      </RecommendationTypes>
      <MaxCount i:nil="false">ValueHere</MaxCount>
    </RetrieveRecommendationsRequest>
  </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>
    <RetrieveRecommendationsResponse xmlns="https://bingads.microsoft.com/AdInsight/v13">
      <Recommendations d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
        <RecommendationBase d4p1:type="-- derived type specified here with the appropriate prefix --">
          <AccountId>ValueHere</AccountId>
          <AccountName d4p1:nil="false">ValueHere</AccountName>
          <AdGroupId d4p1:nil="false">ValueHere</AdGroupId>
          <AdGroupName d4p1:nil="false">ValueHere</AdGroupName>
          <CampaignId d4p1:nil="false">ValueHere</CampaignId>
          <CampaignName d4p1:nil="false">ValueHere</CampaignName>
          <CurrentClicks>ValueHere</CurrentClicks>
          <CurrentConversions>ValueHere</CurrentConversions>
          <CurrentCost>ValueHere</CurrentCost>
          <CurrentImpressions>ValueHere</CurrentImpressions>
          <Dismissed>ValueHere</Dismissed>
          <EstimatedIncreaseInClicks>ValueHere</EstimatedIncreaseInClicks>
          <EstimatedIncreaseInConversions>ValueHere</EstimatedIncreaseInConversions>
          <EstimatedIncreaseInCost>ValueHere</EstimatedIncreaseInCost>
          <EstimatedIncreaseInImpressions>ValueHere</EstimatedIncreaseInImpressions>
          <RecommendationHash d4p1:nil="false">ValueHere</RecommendationHash>
          <RecommendationId d4p1:nil="false">ValueHere</RecommendationId>
          <RecommendationType d4p1:nil="false">ValueHere</RecommendationType>
          <Type>ValueHere</Type>
          <!--These fields are applicable if the derived type attribute is set to CampaignBudgetRecommendation-->
          <BudgetPoints d4p1:nil="false">
            <BudgetPoint>
              <BudgetAmount>ValueHere</BudgetAmount>
              <BudgetPointType>ValueHere</BudgetPointType>
              <EstimatedWeeklyClicks>ValueHere</EstimatedWeeklyClicks>
              <EstimatedWeeklyCost>ValueHere</EstimatedWeeklyCost>
              <EstimatedWeeklyImpressions>ValueHere</EstimatedWeeklyImpressions>
            </BudgetPoint>
          </BudgetPoints>
          <BudgetType>ValueHere</BudgetType>
          <CurrentBudget>ValueHere</CurrentBudget>
          <RecommendedBudget>ValueHere</RecommendedBudget>
          <!--These fields are applicable if the derived type attribute is set to KeywordRecommendation-->
          <Competition>ValueHere</Competition>
          <MatchType>ValueHere</MatchType>
          <MonthlySearches>ValueHere</MonthlySearches>
          <SuggestedBid>ValueHere</SuggestedBid>
          <SuggestedKeyword d4p1:nil="false">ValueHere</SuggestedKeyword>
          <!--This field is applicable if the derived type attribute is set to ResponsiveSearchAdRecommendation-->
          <SuggestedAd d4p1:nil="false">
            <Descriptions d4p1:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
              <a1:string>ValueHere</a1:string>
            </Descriptions>
            <FinalUrl d4p1:nil="false">ValueHere</FinalUrl>
            <Headlines d4p1:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
              <a1:string>ValueHere</a1:string>
            </Headlines>
            <Path1 d4p1:nil="false">ValueHere</Path1>
            <Path2 d4p1:nil="false">ValueHere</Path2>
          </SuggestedAd>
          <!--These fields are applicable if the derived type attribute is set to RemoveConflictingNegativeKeywordRecommendation-->
          <NegativeKeyword d4p1:nil="false">ValueHere</NegativeKeyword>
          <NegativeKeywordId>ValueHere</NegativeKeywordId>
          <NegativeKeywordListName d4p1:nil="false">ValueHere</NegativeKeywordListName>
          <NegativeKeywordMatchType>ValueHere</NegativeKeywordMatchType>
          <NegativeKeywordSharedListId d4p1:nil="false">ValueHere</NegativeKeywordSharedListId>
          <Source d4p1:nil="false">ValueHere</Source>
          <!--These fields are applicable if the derived type attribute is set to UseBroadMatchKeywordRecommendation-->
          <CurrentMatchType>ValueHere</CurrentMatchType>
          <CurrentStatus d4p1:nil="false">ValueHere</CurrentStatus>
          <Keyword d4p1:nil="false">ValueHere</Keyword>
          <KeywordOrderItemId>ValueHere</KeywordOrderItemId>
          <SuggestedBid>ValueHere</SuggestedBid>
          <SuggestedMatchType>ValueHere</SuggestedMatchType>
          <SuggestedStatus d4p1:nil="false">ValueHere</SuggestedStatus>
          <!--These fields are applicable if the derived type attribute is set to ResponsiveSearchAdAssetRecommendation-->
          <RecommendedResponsiveSearchAd d4p1:nil="false">
            <Descriptions d4p1:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
              <a1:string>ValueHere</a1:string>
            </Descriptions>
            <FinalUrl d4p1:nil="false">ValueHere</FinalUrl>
            <Headlines d4p1:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
              <a1:string>ValueHere</a1:string>
            </Headlines>
            <Path1 d4p1:nil="false">ValueHere</Path1>
            <Path2 d4p1:nil="false">ValueHere</Path2>
          </RecommendedResponsiveSearchAd>
          <ResponsiveSearchAdId>ValueHere</ResponsiveSearchAdId>
        </RecommendationBase>
      </Recommendations>
    </RetrieveRecommendationsResponse>
  </s:Body>
</s:Envelope>

代码语法

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

public async Task<RetrieveRecommendationsResponse> RetrieveRecommendationsAsync(
	IList<string> recommendationTypes,
	int? maxCount)
{
	var request = new RetrieveRecommendationsRequest
	{
		RecommendationTypes = recommendationTypes,
		MaxCount = maxCount
	};

	return (await AdInsightService.CallAsync((s, r) => s.RetrieveRecommendationsAsync(r), request));
}
static RetrieveRecommendationsResponse retrieveRecommendations(
	ArrayOfstring recommendationTypes,
	int maxCount) throws RemoteException, Exception
{
	RetrieveRecommendationsRequest request = new RetrieveRecommendationsRequest();

	request.setRecommendationTypes(recommendationTypes);
	request.setMaxCount(maxCount);

	return AdInsightService.getService().retrieveRecommendations(request);
}
static function RetrieveRecommendations(
	$recommendationTypes,
	$maxCount)
{

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

	$request = new RetrieveRecommendationsRequest();

	$request->RecommendationTypes = $recommendationTypes;
	$request->MaxCount = $maxCount;

	return $GLOBALS['AdInsightProxy']->GetService()->RetrieveRecommendations($request);
}
response=adinsight_service.RetrieveRecommendations(
	RecommendationTypes=RecommendationTypes,
	MaxCount=MaxCount)

要求

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

请求 URL

https://adinsight.api.bingads.microsoft.com/AdInsight/v13/Recommendations/Retrieve

请求元素

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

注意

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

请求正文元素

元素 说明 数据类型
MaxCount 返回的建议的最大数目。 默认值为 null。 如果 MaxCount 为 null 或 0,则返回所有可用建议。 可选。 int
RecommendationTypes 建议类型名称:ADD_BROAD_MATCH_KEYWORD、CAMPAIGN_BUDGET、KEYWORD、REMOVE_CONFLICTING_NEGATIVE_KEYWORD、RESPONSIVE_SEARCH_AD或RESPONSIVE_SEARCH_AD_ASSET。 必填。 字符串 数组

请求标头元素

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

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

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

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

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

响应元素

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

响应正文元素

元素 说明 数据类型
建议 特定帐户 ID 的可用建议。 建议的类型包括: AddBroadMatchKeywordRecommendationCampaignBudgetRecommendationKeywordRecommendationRemoveConflictingNegativeKeywordRecommendationResponsiveSearchAdRecommendationResponsiveSearchAdAssetRecommendation RecommendationBase 数组

响应标头元素

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

请求 JSON

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

{
  "RecommendationTypes": [
    "ValueHere"
  ],
  "MaxCount": IntValueHere
}

响应 JSON

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

下面是一个示例,如果 RecommendationBase 的类型为 CampaignBudgetRecommendation,则适用。

{
  "Recommendations": [
    {
      "AccountId": "LongValueHere",
      "AccountName": "ValueHere",
      "AdGroupId": "LongValueHere",
      "AdGroupName": "ValueHere",
      "CampaignId": "LongValueHere",
      "CampaignName": "ValueHere",
      "CurrentClicks": "LongValueHere",
      "CurrentConversions": "LongValueHere",
      "CurrentCost": DoubleValueHere,
      "CurrentImpressions": "LongValueHere",
      "Dismissed": "ValueHere",
      "EstimatedIncreaseInClicks": "LongValueHere",
      "EstimatedIncreaseInConversions": "LongValueHere",
      "EstimatedIncreaseInCost": DoubleValueHere,
      "EstimatedIncreaseInImpressions": "LongValueHere",
      "RecommendationHash": "ValueHere",
      "RecommendationId": "ValueHere",
      "RecommendationType": "ValueHere",
      "Type": "CampaignBudgetRecommendation",
      "BudgetPoints": [
        {
          "BudgetAmount": DoubleValueHere,
          "BudgetPointType": "ValueHere",
          "EstimatedWeeklyClicks": DoubleValueHere,
          "EstimatedWeeklyCost": DoubleValueHere,
          "EstimatedWeeklyImpressions": DoubleValueHere
        }
      ],
      "BudgetType": "ValueHere",
      "CurrentBudget": DoubleValueHere,
      "RecommendedBudget": DoubleValueHere
    }
  ]
}

代码语法

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

public async Task<RetrieveRecommendationsResponse> RetrieveRecommendationsAsync(
	IList<string> recommendationTypes,
	int? maxCount)
{
	var request = new RetrieveRecommendationsRequest
	{
		RecommendationTypes = recommendationTypes,
		MaxCount = maxCount
	};

	return (await AdInsightService.CallAsync((s, r) => s.RetrieveRecommendationsAsync(r), request));
}
static RetrieveRecommendationsResponse retrieveRecommendations(
	ArrayOfstring recommendationTypes,
	int maxCount) throws RemoteException, Exception
{
	RetrieveRecommendationsRequest request = new RetrieveRecommendationsRequest();

	request.setRecommendationTypes(recommendationTypes);
	request.setMaxCount(maxCount);

	return AdInsightService.getService().retrieveRecommendations(request);
}
static function RetrieveRecommendations(
	$recommendationTypes,
	$maxCount)
{

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

	$request = new RetrieveRecommendationsRequest();

	$request->RecommendationTypes = $recommendationTypes;
	$request->MaxCount = $maxCount;

	return $GLOBALS['AdInsightProxy']->GetService()->RetrieveRecommendations($request);
}
response=adinsight_service.RetrieveRecommendations(
	RecommendationTypes=RecommendationTypes,
	MaxCount=MaxCount)