Supplier Integration Examples
.NET code sample for importing supplier products via the Norce Commerce Connect C# client library.
- GitHub: Storm.Connect.Contracts
- NuGet: Enferno.Services.StormConnect.Contracts
- Postman collection: Connect supplier examples
For field reference and the supplier data model, see The Supplier Product Model.
ImportProducts (Supplier)
View .NET code sample
// Using Storm Client library: https://github.com/StormCommerce/Storm.Connect.Contracts
// NuGet: https://www.nuget.org/packages/Enferno.Services.StormConnect.Contracts/
static void Main()
{
var serviceUrl = "https://demo.api-se.norce.tech/commerce/connect/4.0/";
var applicationId = 0;
var secretKey = Guid.NewGuid();
var job = ImportSupplierProduct(serviceUrl, applicationId, secretKey);
}
public static JobDto ImportSupplierProduct(string serviceUrl, int applicationId, Guid secretKey)
{
const int accountId = 0;
const int supplierId = 0; // Supplier ID in Norce
var productHeader = new SupplierProductHeader()
{
AccountId = accountId,
SupplierId = supplierId,
FullFile = false,
FieldsThatAreSet = new List<SupplierProductField>()
{
SupplierProductField.SupplierPartNo,
SupplierProductField.ProductName,
SupplierProductField.CategoryCode,
SupplierProductField.Manufacturer,
SupplierProductField.ManufacturerPartNo
},
OnhandFieldsThatAreSet = new List<SupplierOnHandField>
{
SupplierOnHandField.Value
},
PriceFieldsThatAreSet = new List<SupplierPriceField>
{
SupplierPriceField.CostPurchase
}
};
var requestUri = new Uri(new Uri(serviceUrl), "supplier/ImportProducts");
var myRequest = new MyRequest<SupplierProductHeader, SupplierProduct>(
productHeader, GetSupplierProducts());
return RestHelper.SendStreamedData<JobDto, SupplierProductHeader, SupplierProduct>(
requestUri.AbsoluteUri, applicationId, secretKey, myRequest);
}
private static IEnumerable<SupplierProduct> GetSupplierProducts()
{
return new List<SupplierProduct>
{
new SupplierProduct
{
SupplierPartNo = "SupplierPartNo123", // Required key
ProductName = "TestArticle 123",
CategoryCode = "SupplierCategory01",
Manufacturer = "Manufacturer01", // Required key
ManufacturerPartNo = "TESTMFRPARTNO01", // Required key
OnHand = new List<SupplierOnHand>
{
new SupplierOnHand
{
WarehouseCode = "Standard", // Part of on-hand key
LocationCode = "Standard", // Part of on-hand key
Value = 12M
}
},
PriceList = new List<SupplierPrice>
{
new SupplierPrice
{
PriceListCode = "STD1", // Price key
CurrencyCode = "SEK",
CostPurchase = 125.00M // Excl. VAT
}
}
}
};
}