AddAdExtensions Service Operation

 

Adds one or more ad extensions to an account’s ad extension library.

Request | Response

Error Codes

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

Request Body

The AddAdExtensionsRequest object defines the elements of the request’s body. The elements must be in the same order as shown in the SOAP Request SOAP.

ElementDescriptionData Type
AccountIdThe identifier of the account to add the extensions to.long
AdExtensionsThe list of ad extensions of any type to add to the account. You can specify a maximum of 100 extensions per call.AdExtension array

Request Headers

Set the required header elements for each service request. New customers are required to sign up for Bing Ads with a Microsoft Account, and to manage those accounts you must use OAuth. Existing users with legacy Bing Ads credentials may continue to specify the UserName and Password header elements. In future versions of the API, Bing Ads will transition exclusively to Microsoft Account authentication. For more information, see Getting Started With the Bing Ads API.

OAuth Authentication

These request headers are required for Managing User Authentication with OAuth.

ElementDescriptionData Type
AuthenticationTokenThe OAuth access token used to manage Bing Ads accounts linked to a Microsoft Account.string
CustomerAccountIdThe 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.

Note: Required for service operations related to ad extensions. As a best practice you should always specify this element for operations limited in scope to a single account per service call.
string
CustomerIdThe 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.

Note: Required for service operations related to targeting and editorial. As a best practice you should always specify this element.
string
DeveloperTokenThe client application's developer access token.string

Password Authentication

These request headers are required for legacy username and password authentication.

ElementDescriptionData Type
CustomerAccountIdThe 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.

Note: Required for service operations related to ad extensions. As a best practice you should always specify this element for operations limited in scope to a single account per service call.
string
CustomerIdThe 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.

Note: Required for service operations related to targeting and editorial. As a best practice you should always specify this element.
string
DeveloperTokenThe client application's developer access token.string
PasswordThe Bing Ads user's sign-in password.string
UserNameThe Bing Ads user's sign-in user name. You may not set this element to a Microsoft account or email address.string

Request SOAP

The following example shows the complete request envelope.

<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/v10">
    <Action mustUnderstand="1">AddAdExtensions</Action>
    <ApplicationToken i:nil="false"></ApplicationToken>
    <AuthenticationToken i:nil="false"></AuthenticationToken>
    <CustomerAccountId i:nil="false"></CustomerAccountId>
    <CustomerId i:nil="false"></CustomerId>
    <DeveloperToken i:nil="false"></DeveloperToken>
    <Password i:nil="false"></Password>
    <UserName i:nil="false"></UserName>
  </s:Header>
  <s:Body>
    <AddAdExtensionsRequest xmlns="https://bingads.microsoft.com/CampaignManagement/v10">
      <AccountId></AccountId>
      <AdExtensions i:nil="false">
        <AdExtension i:type="-- specify derived type here with the appropriate prefix --">
          <ForwardCompatibilityMap xmlns:e1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" i:nil="false">
            <e1:KeyValuePairOfstringstring>
              <e1:key i:nil="false"></e1:key>
              <e1:value i:nil="false"></e1:value>
            </e1:KeyValuePairOfstringstring>
          </ForwardCompatibilityMap>
          <Id i:nil="false"></Id>
          <Scheduling i:nil="false">
            <DayTimeRanges i:nil="false">
              <DayTime>
                <Day></Day>
                <EndHour></EndHour>
                <EndMinute></EndMinute>
                <StartHour></StartHour>
                <StartMinute></StartMinute>
              </DayTime>
            </DayTimeRanges>
            <EndDate i:nil="false">
              <Day></Day>
              <Month></Month>
              <Year></Year>
            </EndDate>
            <StartDate i:nil="false">
              <Day></Day>
              <Month></Month>
              <Year></Year>
            </StartDate>
            <UseSearcherTimeZone i:nil="false"></UseSearcherTimeZone>
          </Scheduling>
          <Status i:nil="false"></Status>
          <Type i:nil="false"></Type>
          <Version i:nil="false"></Version>
          <!--Keep these fields if you set the i:type attribute to SiteLinksAdExtension-->
          <SiteLinks i:nil="false">
            <SiteLink>
              <Description1 i:nil="false"></Description1>
              <Description2 i:nil="false"></Description2>
              <DestinationUrl i:nil="false"></DestinationUrl>
              <DevicePreference i:nil="false"></DevicePreference>
              <DisplayText i:nil="false"></DisplayText>
              <FinalAppUrls xmlns:e2="http://schemas.datacontract.org/2004/07/Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V10" i:nil="false">
                <e2:AppUrl>
                  <e2:OsType i:nil="false"></e2:OsType>
                  <e2:Url i:nil="false"></e2:Url>
                </e2:AppUrl>
              </FinalAppUrls>
              <FinalMobileUrls i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
                <a1:string></a1:string>
              </FinalMobileUrls>
              <FinalUrls i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
                <a1:string></a1:string>
              </FinalUrls>
              <Scheduling i:nil="false">
                <DayTimeRanges i:nil="false">
                  <DayTime>
                    <Day></Day>
                    <EndHour></EndHour>
                    <EndMinute></EndMinute>
                    <StartHour></StartHour>
                    <StartMinute></StartMinute>
                  </DayTime>
                </DayTimeRanges>
                <EndDate i:nil="false">
                  <Day></Day>
                  <Month></Month>
                  <Year></Year>
                </EndDate>
                <StartDate i:nil="false">
                  <Day></Day>
                  <Month></Month>
                  <Year></Year>
                </StartDate>
                <UseSearcherTimeZone i:nil="false"></UseSearcherTimeZone>
              </Scheduling>
              <TrackingUrlTemplate i:nil="false"></TrackingUrlTemplate>
              <UrlCustomParameters xmlns:e3="http://schemas.datacontract.org/2004/07/Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V10" i:nil="false">
                <e3:Parameters i:nil="false">
                  <e3:CustomParameter>
                    <e3:Key i:nil="false"></e3:Key>
                    <e3:Value i:nil="false"></e3:Value>
                  </e3:CustomParameter>
                </e3:Parameters>
              </UrlCustomParameters>
            </SiteLink>
          </SiteLinks>
          <!--Keep these fields if you set the i:type attribute to LocationAdExtension-->
          <Address i:nil="false">
            <CityName i:nil="false"></CityName>
            <CountryCode i:nil="false"></CountryCode>
            <PostalCode i:nil="false"></PostalCode>
            <ProvinceCode i:nil="false"></ProvinceCode>
            <ProvinceName i:nil="false"></ProvinceName>
            <StreetAddress i:nil="false"></StreetAddress>
            <StreetAddress2 i:nil="false"></StreetAddress2>
          </Address>
          <CompanyName i:nil="false"></CompanyName>
          <GeoCodeStatus i:nil="false"></GeoCodeStatus>
          <GeoPoint i:nil="false">
            <LatitudeInMicroDegrees></LatitudeInMicroDegrees>
            <LongitudeInMicroDegrees></LongitudeInMicroDegrees>
          </GeoPoint>
          <IconMediaId i:nil="false"></IconMediaId>
          <ImageMediaId i:nil="false"></ImageMediaId>
          <PhoneNumber i:nil="false"></PhoneNumber>
          <!--Keep these fields if you set the i:type attribute to CallAdExtension-->
          <CountryCode i:nil="false"></CountryCode>
          <DevicePreference i:nil="false"></DevicePreference>
          <IsCallOnly i:nil="false"></IsCallOnly>
          <IsCallTrackingEnabled i:nil="false"></IsCallTrackingEnabled>
          <PhoneNumber i:nil="false"></PhoneNumber>
          <RequireTollFreeTrackingNumber i:nil="false"></RequireTollFreeTrackingNumber>
          <!--Keep these fields if you set the i:type attribute to ImageAdExtension-->
          <AlternativeText i:nil="false"></AlternativeText>
          <Description i:nil="false"></Description>
          <DestinationUrl i:nil="false"></DestinationUrl>
          <FinalAppUrls xmlns:e4="http://schemas.datacontract.org/2004/07/Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V10" i:nil="false">
            <e4:AppUrl>
              <e4:OsType i:nil="false"></e4:OsType>
              <e4:Url i:nil="false"></e4:Url>
            </e4:AppUrl>
          </FinalAppUrls>
          <FinalMobileUrls i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:string></a1:string>
          </FinalMobileUrls>
          <FinalUrls i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:string></a1:string>
          </FinalUrls>
          <ImageMediaIds i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:long></a1:long>
          </ImageMediaIds>
          <TrackingUrlTemplate i:nil="false"></TrackingUrlTemplate>
          <UrlCustomParameters xmlns:e5="http://schemas.datacontract.org/2004/07/Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V10" i:nil="false">
            <e5:Parameters i:nil="false">
              <e5:CustomParameter>
                <e5:Key i:nil="false"></e5:Key>
                <e5:Value i:nil="false"></e5:Value>
              </e5:CustomParameter>
            </e5:Parameters>
          </UrlCustomParameters>
          <!--Keep these fields if you set the i:type attribute to AppAdExtension-->
          <AppPlatform i:nil="false"></AppPlatform>
          <AppStoreId i:nil="false"></AppStoreId>
          <DestinationUrl i:nil="false"></DestinationUrl>
          <DevicePreference i:nil="false"></DevicePreference>
          <DisplayText i:nil="false"></DisplayText>
          <FinalAppUrls xmlns:e6="http://schemas.datacontract.org/2004/07/Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V10" i:nil="false">
            <e6:AppUrl>
              <e6:OsType i:nil="false"></e6:OsType>
              <e6:Url i:nil="false"></e6:Url>
            </e6:AppUrl>
          </FinalAppUrls>
          <FinalMobileUrls i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:string></a1:string>
          </FinalMobileUrls>
          <FinalUrls i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:string></a1:string>
          </FinalUrls>
          <TrackingUrlTemplate i:nil="false"></TrackingUrlTemplate>
          <UrlCustomParameters xmlns:e7="http://schemas.datacontract.org/2004/07/Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V10" i:nil="false">
            <e7:Parameters i:nil="false">
              <e7:CustomParameter>
                <e7:Key i:nil="false"></e7:Key>
                <e7:Value i:nil="false"></e7:Value>
              </e7:CustomParameter>
            </e7:Parameters>
          </UrlCustomParameters>
          <!--Keep these fields if you set the i:type attribute to ReviewAdExtension-->
          <IsExact></IsExact>
          <Source i:nil="false"></Source>
          <Text i:nil="false"></Text>
          <Url i:nil="false"></Url>
          <!--Keep these fields if you set the i:type attribute to CalloutAdExtension-->
          <Text i:nil="false"></Text>
          <!--Keep these fields if you set the i:type attribute to Sitelink2AdExtension-->
          <Description1 i:nil="false"></Description1>
          <Description2 i:nil="false"></Description2>
          <DestinationUrl i:nil="false"></DestinationUrl>
          <DevicePreference i:nil="false"></DevicePreference>
          <DisplayText i:nil="false"></DisplayText>
          <FinalAppUrls xmlns:e8="http://schemas.datacontract.org/2004/07/Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V10" i:nil="false">
            <e8:AppUrl>
              <e8:OsType i:nil="false"></e8:OsType>
              <e8:Url i:nil="false"></e8:Url>
            </e8:AppUrl>
          </FinalAppUrls>
          <FinalMobileUrls i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:string></a1:string>
          </FinalMobileUrls>
          <FinalUrls i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:string></a1:string>
          </FinalUrls>
          <TrackingUrlTemplate i:nil="false"></TrackingUrlTemplate>
          <UrlCustomParameters xmlns:e9="http://schemas.datacontract.org/2004/07/Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V10" i:nil="false">
            <e9:Parameters i:nil="false">
              <e9:CustomParameter>
                <e9:Key i:nil="false"></e9:Key>
                <e9:Value i:nil="false"></e9:Value>
              </e9:CustomParameter>
            </e9:Parameters>
          </UrlCustomParameters>
          <!--Keep these fields if you set the i:type attribute to StructuredSnippetAdExtension-->
          <Header i:nil="false"></Header>
          <Values i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:string></a1:string>
          </Values>
        </AdExtension>
      </AdExtensions>
    </AddAdExtensionsRequest>
  </s:Body>
</s:Envelope>

Response Body

ElementDescriptionData Type
AdExtensionIdentitiesThe identities of the extensions that were added. The list corresponds directly to the list of extensions specified in the request.AdExtensionIdentity

Response Header

ElementDescriptionData Type
TrackingIdThe identifier of the log entry that contains details about the API call.string

Response SOAP

The following example shows the complete response envelope.

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns="https://bingads.microsoft.com/CampaignManagement/v10">
    <TrackingId p4:nil="false" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance"></TrackingId>
  </s:Header>
  <s:Body>
    <AddAdExtensionsResponse xmlns="https://bingads.microsoft.com/CampaignManagement/v10">
      <AdExtensionIdentities p4:nil="false" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">
        <AdExtensionIdentity>
          <Id></Id>
          <Version p4:nil="false"></Version>
        </AdExtensionIdentity>
      </AdExtensionIdentities>
    </AddAdExtensionsResponse>
  </s:Body>
</s:Envelope>

If the service operation fails, it throws a FaultException exception, which contains one or more of the Bing Ads API error data objects. For information about the fault detail objects, see Campaign Management Error Data Objects and Handling Service Errors and Exceptions.The following are example error codes that the error objects can include when using this service operation. For all documented error codes, please see Bing Ads Operation Error Codes.

Error Code
InvalidCredentials

DeleteAdExtensions
DeleteAdExtensionsAssociations
GetAdExtensionIdsByAccountId
GetAdExtensionsAssociations
GetAdExtensionsByIds
GetAdExtensionsEditorialReasons
SetAdExtensionsAssociations
UpdateAdExtensions

Community Additions

ADD
Show: