Products integration examples
Examples in postman
Go directly to our postman collection of examples:
- Norce Commerce Connect Product examples
Using client libraries
Norce Commerce has client libraries for c#. Read more about them here:
- Norce Commerce code repositories (Github)
- Norce Commerce Connect contracts and as a nuget
ImportProducts
ImportProducts is used to import products and sku´s from different sources. Like ERP, external PIM (if Norce Commerce´s PIM is not used). Product information from Suppliers is usually imported using the ImportProducts
method in the Supplier namespace. See examples here.
To insert new products in to Norce Commerce, the required keys are:
ManufacturerCode
– Manufacturer Code in NorceManufacturerPartNo
– Combination ofManufacturerCode
andManufacturerPartNo
must be uniquePartNo
– Product identifierStatus
– Product status enumType
– Product type enum
For updating products the required fields are:
PartNo
– SKU identifier
Examples in Postman
Examples in Client Libraries
Here is a code example using .net client library
//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 = ImportProduct(serviceUrl, applicationId, secretKey); } public static JobDto ImportProduct(string serviceUrl, int applicationId, Guid secretKey) { const int accountId = 0; var productHeader = new ProductHeader() { AccountId = accountId, FullFile = false, ProductFieldsThatAreSet = new List<ProductField>() { ProductField.ManufacturerCode, ProductField.Variants, ProductField.Cultures, ProductField.Categories }, ProductCultureFieldsThatAreSet = new List<ProductCultureField> { ProductCultureField.Name, ProductCultureField.Description, ProductCultureField.Title }, VariantFieldsThatAreSet = new List<VariantField> { VariantField.ManufacturerPartNo, VariantField.Skus }, VariantCultureFieldsThatAreSet = new List<VariantCultureField> { }, SkuFieldsThatAreSet = new List<SkuField> { SkuField.Status, SkuField.Type, SkuField.VatRate }, SkuCultureFieldsThatAreSet = new List<SkuCultureField> { SkuCultureField.ErpName, SkuCultureField.Comment }, SkuPriceListFieldsThatAreSet = new List<SkuPriceListField> { }, IgnoreSkuPriceListFieldsWhenEmpty = new List<SkuPriceListField> { }, SkuStructureItemFieldsThatAreSet = new List<SkuStructureItemField> { } }; var requestUri = new Uri(new Uri(serviceUrl), "product/ImportProducts"); var myRequest = new MyRequest<ProductHeader, Product>(productHeader, GetProducts()); return RestHelper.SendStreamedData<JobDto, ProductHeader, Product>( requestUri.AbsoluteUri, applicationId, secretKey, myRequest); } private static IEnumerable<Product> GetProducts() { // NOTE Format and map your data to the Norce Commerce Connect standard here return new List<Product> { new Product { ManufacturerCode = "MFR0000001", // NOTE Required key Variants = new List<Variant> { new Variant { ManufacturerPartNo = "MFRPARTNOTEST01", // NOTE Required key Skus = new List<Sku> { new Sku { PartNo = "TESTSKU01", // NOTE Required key Status = SkuStatus.Active, // NOTE Required key Type = SkuType.Standard, // NOTE Required key VatRates = new List<VatRate> { new VatRate { Rate = 25.00M, SalesArea = SalesArea.Sweden } }, Cultures = new List<SkuCulture> { new SkuCulture { CultureCode = "sv-SE", ErpName = "ERP Name", Comment = "Comment" } } } } } }, Cultures = new List<ProductCulture> { new ProductCulture { CultureCode = "sv-SE", Name = "Name", Description = "Description", Title = "Title" } }, Categories = new List<ProductCategory> { new ProductCategory { Code = "CAT001", SortOrder = 1 } } } }; }
ImportOnhands
ImportOnhands is used to update on hand data for SKU´s, keys are:
PartNo
– Product identifierWarehouseCode
– Warehouse identifierLocationCode
– Warehouse location identifier
SKU, Warehouse and Location must already exist in Norce Commerce, if not – data is ignored.
Examples in Postman
Examples in Client Libraries
Here is a code example using .net client library
//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 = ImportSkuOnhand(serviceUrl, applicationId, secretKey); } public static JobDto ImportSkuOnhand( string serviceUrl, int applicationId, Guid secretKey) { const int accountId = 0; var onhandHeader = new SkuOnhandHeader { AccountId = accountId, FullFile = false, SkuOnhandFieldsThatAreSet = new List<SkuOnhandField>() { // Creates/Updates only the below fields in the import. SkuOnhandField.OnhandValue, SkuOnhandField.IncomingValue, SkuOnhandField.NextDeliveryDate, SkuOnhandField.LeadTimeDayCount } }; var requestUri = new Uri(new Uri(serviceUrl), "product/ImportOnhands"); var myRequest = new MyRequest<SkuOnhandHeader, SkuOnhand>( onhandHeader, GetOnhands()); return RestHelper.SendStreamedData<JobDto, SkuOnhandHeader, SkuOnhand>( requestUri.AbsoluteUri, applicationId, secretKey, myRequest); } private static IEnumerable<SkuOnhand> GetOnhands() { // NOTE Format and map your data to the Norce Commerce Connect standard here return new List<SkuOnhand> { new SkuOnhand { PartNo = "PartNo123", // NOTE This is required key for onhand WarehouseCode = "Warehouse1", // NOTE This is a required key for onhand LocationCode = "Location1", // NOTE This is a required key for onhand OnhandValue = 1.0M, IncomingValue = 2.0M, NextDeliveryDate = DateTime.Now.AddDays(2), LeadTimeDayCount = null } }; }
ImportSkuPriceLists
ImportSkuPriceLists is used to update pricing data for Products (SKUs), keys are:
PartNo
– Product identifierPriceListCode
– Price list identifier (calledAgreement
in Query)QuantityBreak
– Usually 1, quantity break defines at which customer order value a certain price is active.
The Product and Price list must already exist in Norce Commerce, if not – data is ignored.
Examples in Postman
Examples in Client Libraries
Here is a code example using .net client library
//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 = ImportSkuPriceList(serviceUrl, applicationId, secretKey); } public static JobDto ImportSkuPriceList( string serviceUrl, int applicationId, Guid secretKey) { const int accountId = 0; var priceListHeader = new SkuPriceListHeader { AccountId = accountId, FullFile = false, SkuPriceListFieldsThatAreSet = new List<SkuPriceListField>() { // Creates/Updates only the below fields in the import. SkuPriceListField.PriceSale, SkuPriceListField.CostPurchase } }; var requestUri = new Uri(new Uri(serviceUrl), "product/ImportSkuPriceLists"); var myRequest = new MyRequest<SkuPriceListHeader, SkuPriceList>( priceListHeader, GetPriceLists()); return RestHelper.SendStreamedData<JobDto, SkuPriceListHeader, SkuPriceList>( requestUri.AbsoluteUri, applicationId, secretKey, myRequest); } private static IEnumerable<SkuPriceList> GetPriceLists() { // NOTE Format and map your data to the Norce Commerce Connect standard here return new List<SkuPriceList> { new SkuPriceList { PartNo = "PartNo123", // NOTE This is required key for pricelist PriceListCode = "PriceList1", // NOTE This is required key for pricelist QuantityBreak = 1, // NOTE This is a required key for pricelist PriceSale = 2.00M, // Excl VAT CostPurchase = 1.00M, // Excl VAT } }; }
Suggested further reading
- Norce Commerce Connect code examples
- Calling Norce Commerce Connect
- Product and pricing integrations
- Product integration scenarios