Bulk Update Product Overview

Operations


 Name     Description
BulkUpdateFieldsQueueSmart  Imports the file into the Queue in CWA. This will create a Job, and return an immediate response.


Sample c# code


class Program
    {
        static void Main(string[] args)
        {
            var ws = new SCService
            {
                Url = "XXXXX",
 
                AuthHeaderValue = new AuthHeader
                {
                    UserName = "XXXXXX",
                    Password = "XXXXXX"
                }
            };
 
            // Contents is a tab-delimited file
            // - The first column must be ID (Product ID) or UPC
            // - Fields containing the tab character must be enclosed in quotes
            // 
            // - You can refer to the Product class for possible column names
            //   such as Purchaser, ProductName, etc. and their respective data types
 
            var contents = string.Empty;
            
            // Test 1: working sample
            contents = System.IO.File.ReadAllText("SampleBUPFile.txt");
 
            // Test 2: failure sample, due to missing ProductName column for a NEW product
            // contents = System.IO.File.ReadAllText("SampleBUPFile-SupposedToFail.txt");
 
            var IsFirstColumnUPC = false; // FALSE if first column is ProductID (SKU), TRUE if UPC
            var SubtractUnexportedOrderInventoryQty = false; // Set to TRUE if necessary
            var SubtractUnshippedOrderInventoryQty = false; // Set to TRUE if necessary
 
            // By default, only update EXISTING products
            // If this call should also create new products, you must provide the following column
            //    - ProductName
            var CreateNewProducts = true;
 
            var CompanyIDForCurrentlyLoggedOnUser = ws.GetCurrentAmazonMerchantID();
 
            var options = new BulkUpdateOptions
            {
                CompanyIDForNewProducts = CompanyIDForCurrentlyLoggedOnUser, /* or provide a custom company ID for new products */
                OriginalFileName = "Original.FileName.for.Reference",
                OnlyUpdateProductsForCompany = 0 /* Set to a specific company ID if necessary */
            };
 
            // If FALSE, the records should be processed immediately
            // If TRUE, a queued job will be created
            var UseQueue = false;
            
            if (UseQueue)
                // Failures will be logged in CWA
                ws.BulkUpdateFieldsQueueSmart(
                    contents,
                    IsFirstColumnUPC,
                    SubtractUnexportedOrderInventoryQty,
                    CreateNewProducts,
                    SubtractUnshippedOrderInventoryQty,
                    options);
            else
                // Failures will be returned as an exception
                // If a failure is returned, it is possible that the rest of the records were not processed
                // This is why the Queue method is recommended.
                ws.BulkUpdateFieldsExtendedSmart(
                    contents,
                    IsFirstColumnUPC,
                    SubtractUnexportedOrderInventoryQty,
                    CreateNewProducts,
                    SubtractUnshippedOrderInventoryQty,
                    options);
 
            return;
        }

Attachments:

SampleBUPFile-SupposedToFail.txt

SampleBUPFile.txt


How did we do?