Export (0) Print
Expand All

DownloadCampaignsByCampaignIds Service Operation

Downloads the specified campaigns’ data. You can request all campaign data or only the data that has changed since the last time you downloaded the campaign.

Request | Response

Error Codes

Service: BulkService.svc v9 | Namespace: https://bingads.microsoft.com/CampaignManagement/v9

DownloadCampaignsByCampaignIdsRequest Message

Request Body

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

Element

Description

Data Type

Required

Campaigns

The campaigns to download. You can specify a maximum of 1,000 campaigns. The campaigns that you specify must belong to the same account.

CampaignScope array

Yes

DataScope

You may include performance data such as spend, in addition to entity data such as campaign settings. The default is EntityData which will exclude performance data from the download.

You may include multiple values as flags. How you specify multiple flags depends on the programming language that you use. For example, C# treats these values as flag values and Java treats them as an array of strings. The SOAP should include a string that contains a space-delimited list of values for example, <DataScope>EntityData EntityPerformanceData</DataScope>.

System_CLiX_note Note

If BidSuggestionsData, EntityPerformanceData, or QualityScoreData are included, you must request a full sync to get performance data. To perform a full sync, set LastSyncTimeInUTC to NULL.

System_CLiX_note Note

If EntityPerformanceData is included, you must specify the CustomerId in the service request header.

DataScope

No

DownloadFileType

The format of the download file. For possible values, see DownloadFileType. The default is CSV.

DownloadFileType

No

Entities

The entities to include in the download. For a list of entities that you can download, see the BulkDownloadEntity value set.

System_CLiX_note Note

You must specify at least one entity, and otherwise the operation will error.

BulkDownloadEntity

Yes

FormatVersion

The format for records of the download file. Possible values are 2.0 and 1.0.

You should manage records according to the Bulk File Schema for the corresponding format version.

As a best practice you should always specify the latest format version. If not specified, the default value is 1.0, which is deprecated.

string

No

LastSyncTimeInUTC

The last time that you requested a download. The date and time is expressed in Coordinated Universal Time (UTC).

Typically, you request a full download the first time you call the operation by setting this element to null. On all subsequent calls you set the last sync time to the time stamp of the previous download.

The download file contains the time stamp of the download in the SyncTime column of the Account record. Use the time stamp to set LastSyncTimeInUTC the next time that you request a download.

If you specify the last sync time, only those entities that have changed (been updated or deleted) since the specified date and time will be downloaded. However, if the campaign data has not been previously downloaded, the operation performs a full download.

After requesting a full download, the only time that you should again request a full download would be if your account was included in a data migration (for example, the URL by match type migration). If you specify a last sync time that predates the end of the migration process, the download will fail with CampaignServiceFullSyncRequired (error code 3603).

dateTime

No

LocationTargetVersion

The version of the location codes to return if the target contains location targets. You should set this element if you set AdditionalEntities to CampaignTargets or AdGroupTargets.

The following are the possible values. If null, the default is the oldest supported version.

  • Latest – Use the latest supported version

  • 1 – Metro- codes

  • 2 – Nielsen DMA® codes

If the target specifies metro codes and you set version to 2 (or Latest), the service maps the metro codes to DMA® codes and returns them. If the target specifies DMA® codes and you set version to 1, the service maps the DMA® codes to metro codes and returns them.

Because older versions may not be supported in the future, consider setting this element to Latest to avoid breaking changes.

string

No

PerformanceStatsDateRange

Defines the start and end date when downloading performance data.

If the DataScope element includes EntityPerformanceData, then the start and end date must be set with this element.

PerformanceStatsDateRange

No

Request Header

For information about the values you set the DeveloperToken, Password, and UserName elements to, see Getting Started With the Bing Ads API.

Element

Description

Data Type

ApplicationToken

The application-access token. This header element is not used and should be null.

string

AuthenticationToken

The OAuth access token used to manage Bing Ads accounts linked to a Microsoft Account. For more information, see Managing User Authentication with OAuth.

string

CustomerAccountId

The identifier of the account that owns the entities in the request.

string

CustomerId

The identifier of the customer that owns the account.

string

DeveloperToken

The client application's developer access token.

string

Password

The Bing Ads user's sign-in password.

string

UserName

The Bing Ads user's sign-in user name. You may not set this element to a Microsoft account.

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/v9">
    <Action mustUnderstand="1">DownloadCampaignsByCampaignIds</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>
    <DownloadCampaignsByCampaignIdsRequest xmlns="https://bingads.microsoft.com/CampaignManagement/v9">
      <Campaigns i:nil="false">
        <CampaignScope>
          <CampaignId></CampaignId>
          <ParentAccountId></ParentAccountId>
        </CampaignScope>
      </Campaigns>
      <DataScope></DataScope>
      <DownloadFileType i:nil="false"></DownloadFileType>
      <Entities></Entities>
      <FormatVersion i:nil="false"></FormatVersion>
      <LastSyncTimeInUTC i:nil="false"></LastSyncTimeInUTC>
      <LocationTargetVersion i:nil="false"></LocationTargetVersion>
      <PerformanceStatsDateRange i:nil="false">
        <CustomDateRangeEnd i:nil="false">
          <Day></Day>
          <Month></Month>
          <Year></Year>
        </CustomDateRangeEnd>
        <CustomDateRangeStart i:nil="false">
          <Day></Day>
          <Month></Month>
          <Year></Year>
        </CustomDateRangeStart>
        <PredefinedTime i:nil="false"></PredefinedTime>
      </PerformanceStatsDateRange>
    </DownloadCampaignsByCampaignIdsRequest>
  </s:Body>
</s:Envelope>

DownloadCampaignsByCampaignIdsResponse Message

Response Body

Element

Description

Data Type

DownloadRequestId

The identifier of the download request. You use the identifier to call the GetDetailedBulkDownloadStatus operation to check the status of the download. The identifier is valid for a maximum of two days. If you have not successfully downloaded the file within this period, it is removed from the download site and you will need to get a new download request identifier.

string

Response Header

Element

Description

Data Type

TrackingId

The identifier of the log entry that contains the details of the API call.

string

Response SOAP

The following example shows the complete SOAP response envelope.

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns="https://bingads.microsoft.com/CampaignManagement/v9">
    <TrackingId p4:nil="false" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance"></TrackingId>
  </s:Header>
  <s:Body>
    <DownloadCampaignsByCampaignIdsResponse xmlns="https://bingads.microsoft.com/CampaignManagement/v9">
      <DownloadRequestId p4:nil="false" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance"></DownloadRequestId>
    </DownloadCampaignsByCampaignIdsResponse>
  </s:Body>
</s:Envelope>

Error Codes

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 Bulk 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

CampaignServiceCampaignsArrayShouldNotBeNullOrEmpty

CampaignServiceCampaignsArrayExceedsLimit

CampaignServiceCampaignsContainsMultipleAccounts

CampaignServiceCampaignsContainsNullScope

CampaignServiceLastSyncTimeCannotBeInTheFuture

CampaignServiceBulkApiNotEnabledForPilot

CampaignServiceFullSyncRequired

Community Additions

ADD
Show:
© 2014 Microsoft