CMS365.EbaySharp
6.6.5
See the version list below for details.
dotnet add package CMS365.EbaySharp --version 6.6.5
NuGet\Install-Package CMS365.EbaySharp -Version 6.6.5
<PackageReference Include="CMS365.EbaySharp" Version="6.6.5" />
paket add CMS365.EbaySharp --version 6.6.5
#r "nuget: CMS365.EbaySharp, 6.6.5"
// Install CMS365.EbaySharp as a Cake Addin #addin nuget:?package=CMS365.EbaySharp&version=6.6.5 // Install CMS365.EbaySharp as a Cake Tool #tool nuget:?package=CMS365.EbaySharp&version=6.6.5
EbaySharp: A .NET wrapper library for eBay REST API.
EbaySharp is a .NET library that enables you to authenticate and make REST API calls to eBay. This .NET SDK used for creating listings and managing orders using C#.
Installation
EbaySharp is available on NuGet. Use the package manager console in Visual Studio to install it:
Install-Package CMS365.EbaySharp
API support
EbaySharp version | eBay REST API version |
---|---|
6.6.X | Analytics API v1_beta.0.0 |
Browse API v1.19.7 | |
Finances API v1.17.2 | |
Fulfillment API v1.20.4 | |
Inventory API v1.17.4 | |
Key Management API v1.0.0 | |
Metadata API v1.7.1 | |
Stores API v1 | |
Taxonomy API v1.0.1 | |
Trading API (Legacy) v1363 |
EbaySharp currently supports the following Ebay REST APIs:
- Access and Security
- Using the EbaySharp
Access and Security
Create an account here https://developer.ebay.com/my/keys and generate keys for production.
For example:
Navigate to user tokens https://developer.ebay.com/my/auth/?env=production&index=0 and select following options.
From the same page, generate the ebay redirect URL (called RU)
Copy the URL of the field "Your branded eBay Production Sign In (OAuth)" and open in a new browser in private mode and also save a copy of the URL for future use. Log in with your store user ID and password and you will be redirected to the following page
Copy the URL of the thank you page and assign it to a variable called "secureURL" and execute the following function.
public async Task<string> GetRefreshToken()
{
string secureURL="replace with the URL of the thank you page";
EbaySharp.Controllers.IdentityController identityController = new EbaySharp.Controllers.IdentityController();
string refreshToken = await IdentityController.GetRefreshToken(ReplaceYourClientId, ReplaceYourClientSecret,
, secureURL, Replace with RU);
}
This method returns a refresh token which is valid for 18 months or If you change your user/id or password. You will need to re run this function after 18 months when refresh token has expired. We will use the refresh token and generate an access token.
IdentityController identityController=new IdentityController();
var clientCredentials = await identityController.GetClientCredentials(ReplaceYourClientId, ReplaceYourClientSecret, ReplaceWithRefreshToken , ReplaceWithScopes);
Provide scope separated by a space, for example https://api.ebay.com/oauth/api_scope https://api.ebay.com/oauth/api_scope/sell.marketing.readonly This method now gives you ClientCredentialsResponse object which contains an access token.
Using the EbaySharp
Initialize the instance with the access token.
EbayController ebayController = new EbayController(clientCredentials.AccessToken);
Buy
Browse
You can see a list of Browse methods here
Item
Get item
You can find more detail here You need to pass an item Id.
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
Item item = await ebayController.GetItem("355731616267");
Commerce
Taxonomy
You can see a list of Taxonomy methods here
Category Tree
Get category suggestions
You can find more detail here You need to pass a Category Tree Id and the product title you are searching categories for.
CategorySuggestionsList categorySuggestionsList = await ebayController.GetCategorySuggestions(15, "I am a table, look for me");
Get category tree
You can find more detail here You need to pass a Category Tree ID.
CategoryTree categoryTree = await ebayController.GetCategoryTree(15);
Get default category tree Id
You can find more detail here You need to pass MarketplaceId, please visit here for supported market places.
CategoryTreeId categoryTreeId = await ebayController.GetDefaultCategoryTreeId("EBAY_US");
Developer
Analytics
You can see a list of Analytics methods here
Rate Limits
Get rate limits
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
RateLimits rateLimits = await ebayController.GetRateLimits();
Get user rate limits
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
RateLimits rateLimits = await ebayController.GetUserRateLimits();
Key Management
You can see a list of Key management methods here
Signing key
Get signing keys
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
SigningKeys signingKeys = await ebayController.GetSigningKeys();
Get signing key
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
SigningKeys signingKeys = await ebayController.GetSigningKey(string signinKeyId);
Create signing key
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
signingKey = await ebayController.CreateSigningKey(SigningKeyCipher.ED25519);
Sell
Finances
You can see a list of Finances methods here
Transaction
Get transactions
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
//Important! Due to EU & UK Payments regulatory requirements, an additional security verification via Digital Signatures is required for certain API calls that are made on behalf of EU/UK sellers, including all Finances API methods.
SigningKey signingKey = await ebayController.CreateSigningKey(SigningKeyCipher.ED25519);
Transactions transactions = await ebayController.GetTransactions(signingKey);
or
Transactions transactions = await ebayController.GetTransactions();
Fulfillment
You can find more detail here
Order
Get orders by order numbers
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
Orders orders = await ebayController.GetOrders(new string[] { "ORDERNUMBER", "ORDERNUMBER" });
Get orders by filter
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
string dateRange = $"{(DateTime.UtcNow.AddDays(-10).ToString("yyyy-MM-ddThh:mm:00.0Z"))}..{(DateTime.UtcNow.ToString("yyyy-MM-ddThh:mm:00.0Z"))}";
Orders orders = await ebayController.GetOrders($"creationdate:[{dateRange}]",50);
or
orders = await ebayController.GetOrders($"lastmodifieddate:[{dateRange}]");
or
orders = await ebayController.GetOrders("orderfulfillmentstatus:{NOT_STARTED|IN_PROGRESS}");
Shipping Fulfillment
Create shipping Fulfillment
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
List<EbaySharp.Entities.Sell.Fulfillment.Order.Order> allOrders = new List<EbaySharp.Entities.Sell.Fulfillment.Order.Order>();
int totalCount = 0;
do
{
var eBayOrders = await ebayController.GetOrders("orderfulfillmentstatus:{NOT_STARTED|IN_PROGRESS}", 50, totalCount);
totalCount = eBayOrders.Total;
allOrders.AddRange(eBayOrders.OrderList);
} while (allOrders.Count < totalCount);
EbaySharp.Entities.Sell.Fulfillment.Order.Order order = allOrders.Where(x => x.OrderId == orderTracking.OrderNumber).FirstOrDefault();
//Execute the following block in a loop If you have multiple tracking numbers.
await ebayController.CreateShippingFulfillment("Order Number", new EbaySharp.Entities.Sell.Fulfillment.Order.ShippingFulfillment.Fulfillment()
{
LineItems = order.LineItems.Select(x => new EbaySharp.Entities.Sell.Fulfillment.Order.ShippingFulfillment.LineItem()
{
LineItemId = x.LineItemId,
Quantity = x.Quantity
}).ToList(),
TrackingNumber = "Tracking Number",
ShippingCarrierCode = "Courier Name",
ShippedDate = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.0Z")
});
Get shipping Fulfillments
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
Fulfillments fulfillments = await ebayController.GetShippingFulfillments("Order Number");
Get shipping Fulfillment
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
Fulfillment fulfillment = await ebayController.GetShippingFulfillment("Order Number", "Fulfillment Id");
Inventory
You can see a list of Inventory methods here
Inventory Item
Get inventory items
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
InventoryItemsList inventoryItemsList = await ebayController.GetInventoryItems(limit, offset);
Get inventory item
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
InventoryItem inventoryItem = await ebayController.GetInventoryItem(SKU);
Create or replace inventory item
You can find more detail here
Dictionary<string, string[]> aspects = new Dictionary<string, string[]>
{
{ "Brand", new[] { "GoPro" } },
{ "Type", new[] { "Helmet/Action" } }
};
CreatedOrReplacedInventoryItem createdOrReplacedInventoryItem = await ebayController.CreateOrReplaceInventoryItem("test-sku-api", new InventoryItem()
{
Availability = new Availability() { ShipToLocationAvailability = new ShipToLocationAvailability() { Quantity = 3 } },
Condition = ConditionEnum.NEW,
Product = new Product()
{
Title = "Creating from REST API, please don't buy",
Description = "I am created by the REST API",
Aspects = aspects,
Brand = "GoPro",
MPN = "CHDHX-401",
ImageUrls = new[] { "https://i.ebayimg.com/images/g/OKsAAOSwr2VlsUPx/s-l1600.jpg", "https://i.ebayimg.com/images/g/a9AAAOSw2IVlsUPz/s-l1600.jpg" }
},
//Find locale information here https://developer.ebay.com/api-docs/static/rest-request-components.html#marketpl
Locale = "en-AU"
});
Delete inventory item
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
await ebayController.DeleteInventoryItem(SKU);
Inventory Location
Get inventory locations
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
InventoryLocations inventoryLocations = await ebayController.GetInventoryLocations(limit, offset);
Get inventory location
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
InventoryLocation inventoryLocation = await ebayController.GetInventoryLocation(merchantLocationKey);
Create inventory location
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
await ebayController.CreateInventoryLocation(new InventoryLocation()
{
MerchantLocationKey = merchantLocationKey,
LocationTypes = new List<StoreTypeEnum>() { StoreTypeEnum.WAREHOUSE },
MerchantLocationStatus = StatusEnum.ENABLED,
Location = new Location()
{
Address = new Address()
{
PostalCode = "3698",
Country = CountryCodeEnum.AU
}
}
});
Delete inventory location
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
await ebayController.DeleteInventoryLocation(merchantLocationKey);
Listing
Bulk migrate listings
You can find more detail here If you have already created your listing using old API (for example .NET C# SDK), you will need to migrate all listing to new REST API. You can find more detail here
BulkMigrateListingRequest bulkMigrateListingRequest = new BulkMigrateListingRequest()
{
Requests = new BulkMigrateListingRequestItem[]
{
new BulkMigrateListingRequestItem(){ListingId = "21432432432" },
new BulkMigrateListingRequestItem(){ListingId = "78658678678" }
}
});
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
BulkMigrateListingResponse bulkMigrateListingResponse = await ebayController.BulkMigrate(bulkMigrateListingRequest);
Create a new listing
If you want to create a new listing, you will need to perform following 3 steps.
1 - Create a new inventory item
MarketplaceEnum? marketplaceId = MarketplaceEnum.EBAY_AU (for example)
CurrencyCodeEnum? CurrencyCodeId = CurrencyCodeEnum.AUD (for example)
EbaySharp.Entities.Sell.Inventory.InventoryItem.InventoryItem inventoryItem = new EbaySharp.Entities.Sell.Inventory.InventoryItem.InventoryItem()
{
Condition = ConditionEnum.NEW,
Availability = new Availability() { ShipToLocationAvailability = new ShipToLocationAvailability() { Quantity = 3, AllocationByFormat = new AllocationByFormat() { FixedPrice = 3 } } },
Product = new EbaySharp.Entities.Sell.Inventory.InventoryItem.Product()
{
Title = YOUR PRODCT TITLE,
Aspects = DICTIONARY OF ASPECTS IN Dictionary<string, string[]> FORMAT,
Brand = PRODUCT BRAND,
MPN = SKU/MPN,
ImageUrls = ARRAY OF IMAGE URLS
},
Locale = LOCALE OF YOUR STORE
};
CreatedOrReplacedInventoryItem createdOrReplacedInventoryItem = await ebayController.CreateOrReplaceInventoryItem(UNIQUE SKU OF THE PRODUCT, inventoryItem);
2 - Create a new offer You can see detail here
3 - Publish offer You can see detail here
Revise a listing
If you want to revise a listing, you will need to perform following 4 steps.
1 - Get an existing inventory item you want to revise You can see detail here 2 - Get an existing offer
Offers offers = await ebayController.GetOffers(product.SKU);
Offer offer = offers.OfferList.FirstOrDefault();
3 - Make changes in the inventory item or offer
string locale = "en-AU" //FOR EXAMPLE
inventoryItem.Product.Title = UPDATED TITLE;
offer.PricingSummary.Price.Value = NEW PRICE;
offer.AvailableQuantity = NEW STOCK;
await ebayController.CreateOrReplaceInventoryItem(product.SKU, inventoryItem);
await ebayController.UpdateOffer(offer.OfferId, offer, locale);
4 - Publish offer
OfferPublished offerPublished = await ebayController.PublishOffer(offer.OfferId, locale);
Update an active listing
If you want to update an existing active listing, you will need to perform following 3 steps.
1 - Get an existing inventory item you want to update You can see detail here 2 - Get an existing offer
Offers offers = await ebayController.GetOffers(product.SKU);
Offer offer = offers.OfferList.FirstOrDefault();
3 - Make changes in the inventory item or offer
string locale = "en-AU" //FOR EXAMPLE
inventoryItem.Product.Title = UPDATED TITLE;
offer.PricingSummary.Price.Value = NEW PRICE;
offer.AvailableQuantity = NEW STOCK;
await ebayController.CreateOrReplaceInventoryItem(product.SKU, inventoryItem);
await ebayController.UpdateOffer(offer.OfferId, offer, locale);
End a listing
If you want to end a listing, you will need to perform following 2 steps.
1 - Get an offer and set quantity to 0
Offers offers = await ebayController.GetOffers(SKU);
Offer offer = offers.OfferList.FirstOrDefault();
offer.AvailableQuantity = 0; //optional
2 - Withdraw offer
OfferWithdrawn offerWithdrawn = await ebayController.WithdrawOffer(offer.OfferId);
Offer
Get offers
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
OffersList offersList = await ebayController.GetOffers(SKU);
Get offer
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
Offer offer = await ebayController.GetOffer(offerId);
Create offer
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
Offer offer = new Offer()
{
SKU = SKU,
MarketplaceId = MarketplaceEnum.EBAY_AU,
Format = FormatTypeEnum.FIXED_PRICE,
PricingSummary = new PricingSummary()
{
Price = new Amount()
{
Currency = "AUD",
Value = "75"
}
},
MerchantLocationKey = inventoryLocation.MerchantLocationKey,
CategoryId = "162480",
ListingPolicies = new ListingPolicies()
{
FulfillmentPolicyId = "ReplaceYourFulfillmentPolicyId",
PaymentPolicyId = "ReplaceYourPaymentPolicyId",
ReturnPolicyId = "ReplaceYourReturnPolicyId"
}
};
OfferCreated offerCreated = await ebayController.CreateOffer(offer, "en-AU");
Update offer
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
Offer offer = await ebayController.GetOffer(offerId);
offer.PricingSummary.Price.Value = "100";
OfferUpdated offerUpdated = await ebayController.UpdateOffer(offerId, offer, "en-AU");
Publish offer
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
OfferPublished offerPublished = await ebayController.PublishOffer(offerId, "en-AU");
Withdraw offer
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
OfferWithdrawn offerWithdrawn = await ebayController.WithdrawOffer(offerId);
Delete offer
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
await ebayController.DeleteOffer(offerId);
Metadata
You can see a list of Metadata methods here
Marketplace
Get return policies
You need to pass MarketplaceId, please visit here for supported market places.
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
ReturnPoliciesList returnPoliciesList = await ebayController.GetReturnPolicies("EBAY_US");
Stores
You can see a list of Store methods here
Store
Get store categories
You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
StoreCategories storeCategories = await ebayController.GetStoreCategories();
Trading
This is a legacy API, I have added only 1 method with a few important fields only. You can see a list of Trading call categories here
Standard Listing Calls
GetSellerList
This method is used to get a list of all active and ended items. You can find more detail here
EbaySharp.Controllers.EbayController ebayController = new EbaySharp.Controllers.EbayController(clientCredentials.AccessToken);
int pageNumber = 0;
bool hasMoreResults = true;
while (hasMoreResults)
{
GetSellerListResponse getSellerListResponse = await ebayController.GetItems(++pageNumber, 200, DateTime.Now.AddDays(-87).ToString("O"), DateTime.Now.AddDays(33).ToString("O"));
hasMoreResults = getSellerListResponse.HasMoreItems;
//Process items response here.
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Portable.BouncyCastle (>= 1.9.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.1.1 | 96 | 10/21/2024 |
8.1.0 | 123 | 8/3/2024 |
8.0.0.1 | 93 | 7/14/2024 |
8.0.0 | 79 | 7/14/2024 |
6.6.6.1 | 73 | 7/14/2024 |
6.6.6 | 104 | 7/8/2024 |
6.6.5 | 82 | 7/2/2024 |
6.6.4 | 111 | 6/27/2024 |
6.6.3 | 114 | 6/6/2024 |
6.6.2 | 110 | 6/4/2024 |
6.6.1 | 117 | 5/26/2024 |
6.5.1 | 134 | 3/22/2024 |
6.5.0 | 112 | 3/1/2024 |
6.4.0 | 105 | 2/17/2024 |
6.3.0 | 105 | 2/14/2024 |
6.2.1 | 108 | 2/2/2024 |
6.2.0 | 98 | 2/2/2024 |
6.1.0 | 102 | 1/29/2024 |
6.0.1 | 90 | 1/27/2024 |
6.0.0 | 88 | 1/26/2024 |
1.0.10 | 90 | 1/25/2024 |
1.0.9 | 103 | 1/23/2024 |
1.0.8 | 103 | 1/22/2024 |
1.0.7 | 97 | 1/22/2024 |
1.0.6 | 95 | 1/22/2024 |
1.0.5 | 98 | 1/22/2024 |
1.0.4 | 101 | 1/19/2024 |
1.0.3 | 127 | 1/14/2024 |
1.0.2 | 114 | 1/13/2024 |
1.0.1 | 1,355 | 1/13/2024 |