Developers Program

Removing InternationalShippingServiceOptions using the .NET SDK

Published: August 07 2006, 4:25:00 PMยทUpdated: July 25 2022, 9:19:11 AM

Products

Question

How can I remove the InternationalShippingService Options using the .NET SDK?

Answer

To remove all the InternationalShippingServiceOption tags for an Item, you need to send in all the domestic shipping services and specify an empty tag for InternationalShippingServiceOption. Here is a sample C# code using the .NET SDK to make a call to ReviseItem for removing just the International ShippingServiceOption (s).

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

namespace SDK3Examples
{

public class ReviseItem
{
public string ReviseItem(string itemID)
{
ReviseItemCall call = new ReviseItemCall(GetContext());
ItemType item = new ItemType();
item.ItemID = itemID;
item.ShippingDetails = new ShippingDetailsType();

//Mention all the domestic Shipping Service Options
item.ShippingDetails.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection();
ShippingServiceOptionsType[] opt = new ShippingServiceOptionsType[2];
opt[0] = new ShippingServiceOptionsType();
opt[0].ShippingServiceCost = new AmountType();
opt[0].ShippingServiceCost.currencyID = CurrencyCodeType.USD;
opt[0].ShippingServiceCost.Value = 4.25;
opt[0].ShippingServiceAdditionalCost = new AmountType();
opt[0].ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.USD;
opt[0].ShippingServiceAdditionalCost.Value = 1.5;
opt[0].ShippingService = "ShippingMethodStandard";
opt[0].ShippingServicePriority = 1;
item.ShippingDetails.ShippingServiceOptions.Add(opt[0]);

opt[1] = new ShippingServiceOptionsType();
opt[1].ShippingServiceCost = new AmountType();
opt[1].ShippingServiceCost.currencyID = CurrencyCodeType.USD;
opt[1].ShippingServiceCost.Value = 7.0;
opt[1].ShippingServiceAdditionalCost = new AmountType();
opt[1].ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.USD;
opt[1].ShippingServiceAdditionalCost.Value = 3;
opt[1].ShippingService = "USPSPriority";
opt[1].ShippingServicePriority = 2;
item.ShippingDetails.ShippingServiceOptions.Add(opt[1]);

//Specify an empty InternationShippingServiceOption object
item.ShippingDetails.InternationalShippingServiceOption = new InternationalShippingServiceOptionsTypeCollection();
InternationalShippingServiceOptionsType Iopt = new InternationalShippingServiceOptionsType();
Iopt = new InternationalShippingServiceOptionsType();
item.ShippingDetails.InternationalShippingServiceOption.Add(Iopt);

FeeTypeCollection fees = call.ReviseItem(item, null);
}

public ApiContext GetContext()
{
ApiContext context = new ApiContext();

// Set Auth&Auth Token for the call

context.ApiCredential.eBayToken = "token";

// Set the URL
context.SoapApiServerUrl = "https://api.sandbox.ebay.com/wsapi";

// Set logging
context.ApiLogManager = newApiLogManager();
context.ApiLogManager.ApiLoggerList.Add(new eBay.Service.Util.FileLogger("Messages.log", true, true, true));
context.ApiLogManager.EnableLogging = true;

// Set the version
context.Version = "1131";

return context;

}

}

}
How well did this answer your question?