eBay大中华区API开发者平台 开发者专区

搜 索
首页>API开发者平台>技术文档>调用ReviseInventoryStatus可以修改任一给定属性的商品数量至0

技术文档

问题
调用ReviseInventoryStatus可以修改任一给定属性的商品数量至0
解答
0
人觉得答案有帮助)

 

具体代码如下,相应的SOAP请求附于文末。

 

请注意,例程使用了下列SKU:

 1359          9013         1724         4539

   

using System; 
using eBay.Service.Call; 
using eBay.Service.Core.Sdk; 
using eBay.Service.Util; 
using eBay.Service.Core.Soap; 

namespace Trading_Samples 

    public class Revise 
    { 
        static void Main(string[] args) 
        { 
            Revise test = new Revise(); 
            test.ReviseInventoryStatus(); 
        } 
        //ReviseInventoryStatus 
        private void ReviseInventoryStatus() 
        { 

            //create the context 
            ApiContext context = new ApiContext(); 

            //set the User token 
            context.ApiCredential.eBayToken = "Your token"; 
             
            //set the server url 
            context.SoapApiServerUrl = "https://api.sandbox.ebay.com/wsapi"; 

            //enable logging 
            context.ApiLogManager = new ApiLogManager(); 
            context.ApiLogManager.ApiLoggerList.Add(new FileLogger("log.txt", true, true, true)); 
            context.ApiLogManager.EnableLogging = true; 

            //set the version 
            context.Version = "673"; 
            context.Site = SiteCodeType.Australia; 

            ReviseInventoryStatusCall ris = new ReviseInventoryStatusCall(context); 

            //RIS is a light-weight call that allows you to revise price and/qty of 4 SKUs at a time 
            ris.InventoryStatuList = new InventoryStatusTypeCollection(); 
            AmountType atUp = new AmountType(); 
            atUp.currencyID = CurrencyCodeType.AUD; 
            atUp.Value = 75; 

            AmountType atDown = new AmountType(); 
            atDown.currencyID = CurrencyCodeType.AUD; 
            atDown.Value = 25; 

            InventoryStatusType InvStatus1 = new InventoryStatusType(); 

            //Assumption item is listed with InventoryTrackingMethod = SKU. This SKU could be the SKU of a regular fixed price item 
            //or the SKU of one of the variations of a multi-variations item 
            InvStatus1.SKU = "1359"; 

            //Revising price and qty 
            InvStatus1.StartPrice = atDown; 
            InvStatus1.Quantity = 20; 

            ris.InventoryStatuList.Add(InvStatus1); 

            InventoryStatusType InvStatus2 = new InventoryStatusType(); 
            InvStatus2.SKU = "9013"; 
            InvStatus2.StartPrice = atUp; 
            InvStatus2.Quantity = 20; 

            ris.InventoryStatuList.Add(InvStatus2); 

            //Revising price only 
            InventoryStatusType InvStatus3 = new InventoryStatusType(); 
            InvStatus3.SKU = "1724"; 
            InvStatus3.StartPrice = atDown; 

            ris.InventoryStatuList.Add(InvStatus3); 

            //Revising qty only 
            InventoryStatusType InvStatus4 = new InventoryStatusType(); 
            InvStatus4.SKU = "4539"; 
            InvStatus4.Quantity = 20; 

            ris.InventoryStatuList.Add(InvStatus4); 

            ris.Execute(); 
            Console.WriteLine(ris.ApiResponse.Ack); 

        } 
    } 

}

 

  附件
   • XML document RIS 673.xml

 


答案对您有帮助吗?

是,对我很有帮助
否,没解决我的问题