GetKeywordsByAdGroupId Service Operation - Campaign Management

Gets the keywords within an ad group.

Request Elements

The GetKeywordsByAdGroupIdRequest object defines the body and header elements of the service operation request. The elements must be in the same order as shown in the Request SOAP.

Request Body Elements

Element Description Data Type
AdGroupId The identifier of the ad group that keywords are returned for. long
ReturnAdditionalFields The list of additional properties that you want included within each returned Keyword object. This set of flags enables you to get the latest features using the current version of Bing Ads Campaign Management API, and in the next version the corresponding elements will be included by default. KeywordAdditionalField

Request Header Elements

Element Description Data Type
AuthenticationToken The OAuth access token that represents a Microsoft Account user who has permissions to Bing Ads accounts. string
CustomerAccountId The identifier of the account that owns the entities in the request. This header element must have the same value as the AccountId body element when both are required. string
CustomerId The identifier of the customer that contains and owns the account. If you manage an account of another customer, you should use that customer ID instead of your own customer ID. string
DeveloperToken The developer token used to access the Bing Ads API. string
Password The Bing Ads managed user's sign-in password. string
UserName The Bing Ads managed user's sign-in name. You must not set this element to a Microsoft account or email address. string

Important

The UserName and Password header elements are deprecated. In future versions of the API, Bing Ads will transition exclusively to Microsoft Account (email address) authentication. For more information, see Authentication with OAuth. UserName and Password are still required for Bing Ads managed credentials, but they are not applicable for Microsoft account authentication. To authenticate a Microsoft account, use the AuthenticationToken] header instead of UserName and Password.

Note

The CustomerAccountId and CustomerId are required for most service operations, and as a best practice you should always specify them in the request.

Response Elements

The GetKeywordsByAdGroupIdResponse object defines the body and header elements of the service operation response. The elements are returned in the same order as shown in the Response SOAP.

Response Body Elements

Element Description Data Type
Keywords An array of Keyword objects that represents the retrieved keywords. If no keywords exist, an empty array is returned. Keyword array

Response Header Elements

Element Description Data Type
TrackingId The identifier of the log entry that contains the details of the API call. string

Request SOAP

The following template shows the order of the body and header elements for the SOAP request.

<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/CampaignManagement/v11">
    <Action mustUnderstand="1">GetKeywordsByAdGroupId</Action>
    <ApplicationToken i:nil="false">ValueHere</ApplicationToken>
    <AuthenticationToken i:nil="false">ValueHere</AuthenticationToken>
    <CustomerAccountId i:nil="false">ValueHere</CustomerAccountId>
    <CustomerId i:nil="false">ValueHere</CustomerId>
    <DeveloperToken i:nil="false">ValueHere</DeveloperToken>
    <Password i:nil="false">ValueHere</Password>
    <UserName i:nil="false">ValueHere</UserName>
  </s:Header>
  <s:Body>
    <GetKeywordsByAdGroupIdRequest xmlns="https://bingads.microsoft.com/CampaignManagement/v11">
      <AdGroupId>ValueHere</AdGroupId>
      <ReturnAdditionalFields i:nil="false">ValueHere</ReturnAdditionalFields>
    </GetKeywordsByAdGroupIdRequest>
  </s:Body>
</s:Envelope>

Response SOAP

The following template shows the order of the body and header elements for the SOAP response.

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns="https://bingads.microsoft.com/CampaignManagement/v11">
    <TrackingId d3p1:nil="false" xmlns:d3p1="http://www.w3.org/2001/XMLSchema-instance">ValueHere</TrackingId>
  </s:Header>
  <s:Body>
    <GetKeywordsByAdGroupIdResponse xmlns="https://bingads.microsoft.com/CampaignManagement/v11">
      <Keywords d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
        <Keyword>
          <Bid d4p1:nil="false">
            <Amount d4p1:nil="false">ValueHere</Amount>
          </Bid>
          <BiddingScheme d4p1:nil="false" d4p1:type="-- derived type specified here with the appropriate prefix --">
            <Type d4p1:nil="false">ValueHere</Type>
            <!--This field is applicable if the derived type attribute is set to MaxClicksBiddingScheme-->
            <MaxCpc d4p1:nil="false">
              <Amount d4p1:nil="false">ValueHere</Amount>
            </MaxCpc>
            <!--This field is applicable if the derived type attribute is set to MaxConversionsBiddingScheme-->
            <MaxCpc d4p1:nil="false">
              <Amount d4p1:nil="false">ValueHere</Amount>
            </MaxCpc>
            <!--These fields are applicable if the derived type attribute is set to TargetCpaBiddingScheme-->
            <MaxCpc d4p1:nil="false">
              <Amount d4p1:nil="false">ValueHere</Amount>
            </MaxCpc>
            <TargetCpa d4p1:nil="false">ValueHere</TargetCpa>
            <!--No additional fields are applicable if the derived type attribute is set to ManualCpcBiddingScheme-->
            <!--No additional fields are applicable if the derived type attribute is set to EnhancedCpcBiddingScheme-->
            <!--This field is applicable if the derived type attribute is set to InheritFromParentBiddingScheme-->
            <InheritedBidStrategyType d4p1:nil="false">ValueHere</InheritedBidStrategyType>
          </BiddingScheme>
          <DestinationUrl d4p1:nil="false">ValueHere</DestinationUrl>
          <EditorialStatus d4p1:nil="false">ValueHere</EditorialStatus>
          <FinalAppUrls xmlns:e235="http://schemas.datacontract.org/2004/07/Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V11" d4p1:nil="false">
            <e235:AppUrl>
              <e235:OsType d4p1:nil="false">ValueHere</e235:OsType>
              <e235:Url d4p1:nil="false">ValueHere</e235:Url>
            </e235:AppUrl>
          </FinalAppUrls>
          <FinalMobileUrls d4p1:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:string>ValueHere</a1:string>
          </FinalMobileUrls>
          <FinalUrls d4p1:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:string>ValueHere</a1:string>
          </FinalUrls>
          <ForwardCompatibilityMap xmlns:e236="http://schemas.datacontract.org/2004/07/System.Collections.Generic" d4p1:nil="false">
            <e236:KeyValuePairOfstringstring>
              <e236:key d4p1:nil="false">ValueHere</e236:key>
              <e236:value d4p1:nil="false">ValueHere</e236:value>
            </e236:KeyValuePairOfstringstring>
          </ForwardCompatibilityMap>
          <Id d4p1:nil="false">ValueHere</Id>
          <MatchType d4p1:nil="false">ValueHere</MatchType>
          <Param1 d4p1:nil="false">ValueHere</Param1>
          <Param2 d4p1:nil="false">ValueHere</Param2>
          <Param3 d4p1:nil="false">ValueHere</Param3>
          <Status d4p1:nil="false">ValueHere</Status>
          <Text d4p1:nil="false">ValueHere</Text>
          <TrackingUrlTemplate d4p1:nil="false">ValueHere</TrackingUrlTemplate>
          <UrlCustomParameters xmlns:e237="http://schemas.datacontract.org/2004/07/Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V11" d4p1:nil="false">
            <e237:Parameters d4p1:nil="false">
              <e237:CustomParameter>
                <e237:Key d4p1:nil="false">ValueHere</e237:Key>
                <e237:Value d4p1:nil="false">ValueHere</e237:Value>
              </e237:CustomParameter>
            </e237:Parameters>
          </UrlCustomParameters>
        </Keyword>
      </Keywords>
    </GetKeywordsByAdGroupIdResponse>
  </s:Body>
</s:Envelope>

Code Syntax

The example syntax can be used with Bing Ads SDKs. See Bing Ads Code Examples for more examples.

public async Task<GetKeywordsByAdGroupIdResponse> GetKeywordsByAdGroupIdAsync(
    long adGroupId,
    KeywordAdditionalField? returnAdditionalFields)
{
    var request = new GetKeywordsByAdGroupIdRequest
    {
        AdGroupId = adGroupId,
        ReturnAdditionalFields = returnAdditionalFields
    };

    return (await CampaignManagementService.CallAsync((s, r) => s.GetKeywordsByAdGroupIdAsync(r), request));
}
static GetKeywordsByAdGroupIdResponse getKeywordsByAdGroupId(
    java.lang.Long adGroupId,
    ArrayList<KeywordAdditionalField> returnAdditionalFields) throws RemoteException, Exception
{
    GetKeywordsByAdGroupIdRequest request = new GetKeywordsByAdGroupIdRequest();

    request.setAdGroupId(adGroupId);
    request.setReturnAdditionalFields(returnAdditionalFields);

    return CampaignManagementService.getService().getKeywordsByAdGroupId(request);
}
static function GetKeywordsByAdGroupId(
    $adGroupId,
    $returnAdditionalFields)
{

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

    $request = new GetKeywordsByAdGroupIdRequest();

    $request->AdGroupId = $adGroupId;
    $request->ReturnAdditionalFields = $returnAdditionalFields;

    return $GLOBALS['CampaignManagementProxy']->GetService()->GetKeywordsByAdGroupId($request);
}
response=campaignmanagement_service.GetKeywordsByAdGroupId(
    AdGroupId=AdGroupId,
    ReturnAdditionalFields=ReturnAdditionalFields)

Requirements

Service: CampaignManagementService.svc v11
Namespace: https://bingads.microsoft.com/CampaignManagement/v11