Keyword Label Record - Bulk

Defines an association record between a Keyword and a Label that can be uploaded and downloaded in a bulk file. To upload or download the keyword or label, use the Keyword or Label record.

You can download all Keyword Label records in the account by including the DownloadEntity value of KeywordLabels in the DownloadCampaignsByAccountIds or DownloadCampaignsByCampaignIds service request. Additionally the download request must include the EntityData scope. For more details about the Bulk service including best practices, see Bulk Download and Upload.

The following Bulk CSV example would apply a label to a keyword if valid Id and Parent Id values are provided.

Type,Status,Id,Parent Id,Campaign,Ad Group,Client Id,Modified Time,Name,Description,Label,Color
Format Version,,,,,,,,6.0,,,
Keyword Label,,-22,-11113,,,ClientIdGoesHere,,,,,

If you are using the Bing Ads SDKs for .NET, Java, or Python, you can save time using the BulkServiceManager to upload and download the BulkKeywordLabel object, instead of calling the service operations directly and writing custom code to parse each field in the bulk file.

var uploadEntities = new List<BulkEntity>();

// Map properties in the Bulk file to the BulkKeywordLabel
var bulkKeywordLabel = new BulkKeywordLabel
{
    // 'Client Id' column header in the Bulk file
    ClientId = "ClientIdGoesHere",

    // Map properties in the Bulk file to the 
    // LabelAssociation object of the Campaign Management service.
    LabelAssociation = new LabelAssociation
    {
        // 'Parent Id' column header in the Bulk file
        EntityId = keywordIdKey,
        // 'Id' column header in the Bulk file
        LabelId = labelIdKey
    },

    // 'Status' column header in the Bulk file
    Status = Status.Active
};

uploadEntities.Add(bulkKeywordLabel);

var entityUploadParameters = new EntityUploadParameters
{
    Entities = uploadEntities,
    ResponseMode = ResponseMode.ErrorsAndResults,
    ResultFileDirectory = FileDirectory,
    ResultFileName = DownloadFileName,
    OverwriteResultFile = true,
};

var uploadResultEntities = (await BulkServiceManager.UploadEntitiesAsync(entityUploadParameters)).ToList();

For a Keyword Label record, the following attribute fields are available in the Bulk File Schema.

Client Id

Used to associate records in the bulk upload file with records in the results file. The value of this field is not used or stored by the server; it is simply copied from the uploaded record to the corresponding result record. It may be any valid string to up 100 in length.

Add: Optional
Delete: Read-only

Id

The identifier of the label that is applied or removed from the keyword.

This bulk field maps to the Id field of the Label record.

Add: Read-only and Required. You must either specify an existing label identifier, or specify a negative identifier that is equal to the Id field of the parent Label record. This is recommended if you are applying new labels to keywords in the same Bulk file. For more information, see Bulk File Schema Reference Keys.
Delete: Read-only and Required

Modified Time

The date and time that the entity was last updated. The value is in Coordinated Universal Time (UTC).

Note

The date and time value reflects the date and time at the server, not the client. For information about the format of the date and time, see the dateTime entry in Primitive XML Data Types.

Add: Read-only
Delete: Read-only

Parent Id

The identifier of the keyword where this label is applied or removed.

This bulk field maps to the Id field of the Keyword record.

Add: Read-only and Required. You must either specify an existing keyword identifier, or specify a negative identifier that is equal to the Id field of the parent Keyword record. This is recommended if you are applying labels to a new keyword in the same Bulk file. For more information, see Bulk File Schema Reference Keys.
Delete: Read-only and Required

Status

Represents the applied status between the keyword and the label.

Possible values are Active and Deleted. If the label is applied to the keyword, this field's value is Active.

Add: Read-only
Delete: Required. The Status must be set to Deleted.