Newegg Marketplace SDK(C#) is a library to help .Net programmers easily integrate their application with the Newegg Marketplace API. Included are definitions for the data objects models to create the request and resolve the response. The logger and retry mechanism can be customized to your requirements.
To use the SDK to communicate with the Newegg API, you need to be a registered seller and have an 'API Key(Authorization)' and 'Secret Key'. Please visit Newegg Marketplace Seller Portal to request API credentials. Review the Seller Help Guide to learn about detailed instruction. Put this information into a JSON file and load the setting using the APIConfig.FromJsonFile method. Without the 'API Key(Authorization)' and 'Secret Key' you can run the test project in Simulation Mode. This is provided to help you understand the SDK before actual use.
The solution contains 2 library projects: Newegg.Marketplace.SDK.Base and Newegg.Marketplace.SDK. The first one is the framework of the SDK, and the second one is the business logic model and interface to various API. The code is based on .NET Standard 2.0, you can build it with .Net framework 4.6 or .Net Core 2.1.
The package is on Nuget. You can install it with the Nuget Package Manager, search for 'newegg.marketplace.sdk'. You can also install it with the following tools:
Install-Package Newegg.Marketplace.SDK -Version <current version number>
Install-Package Newegg.Marketplace.SDK -Version <current version number>
<PackageReference Include="Newegg.Marketplace.SDK" Version="<current version number>" />
paket add Newegg.Marketplace.SDK --version <current version number>
You can download the zip file and build it for your target frameworks(.Net framework4.6 or .Net core2.1). You can choose manually build it and link library from your project or direct include the project to your solution. We recommend using Visual Studio 2017 or later. You can choose to build it with the command following too.
dotnet build Newegg.Marketplace.SDK
{
"SellerID": "****",
"Credentials": {
"Authorization": "********************************",
"SecretKey": "*******-****-****-****-************"
},
"Connection": {
"RequestTimeoutMs": 20000,
"AttemptsTimes": 3,
"RetryIntervalMs": 3000
},
"APIFormat": "XML",
"Platform": "CAN"
}
APIConfig config = APIConfig.FromJsonFile(PathOfTheJSONConfigFile);
APIClient client = new APIClient(config);
OrderCall ordercall = new OrderCall(client);
var orderstatus = await ordercall.GetOrderStatus("105137040", 304);
What's the settings in the Config?
How to get the API key and Secret Key?
NLog configuration file location and how to customize log
Please refer https://github.com/NLog/NLog/wiki/Configuration-file#configuration-file-locations
How to use the Mock model?
Set the SimulationEnabled to be 'true' to the APIClient object.
fakeUSAClientXML = new APIClient(USA_Config_XML) { SimulationEnabled = true };
Where is the example code?
There is an example project in the solution.
https://github.com/Newegg/newegg-marketplace-sdk-dotnet/tree/master/Newegg.Marketplace.SDK/example