# Products integration examples ## Examples in postman Go directly to our postman collection of examples: - Norce Commerce Connect [Product examples](https://documenter.getpostman.com/view/2973406/2sA35MzJve#72729e05-e755-466a-bbfe-84dc8e82eac5) ## Using client libraries Norce Commerce has client libraries for c#. Read more about them here: - [Norce Commerce code repositories](https://github.com/StormCommerce) (Github) - [Norce Commerce Connect contracts](https://github.com/StormCommerce/Storm.Connect.Contracts) and as a [nuget](https://www.nuget.org/packages/Enferno.Services.StormConnect.Contracts) ## ImportProducts [ImportProducts](/api-reference/connect/productservice/openapi/product/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](/developer-portal/system-integration/supplier-integration-examples). To **insert** new products in to Norce Commerce, the required keys are: - `ManufacturerCode` – Manufacturer Code in Norce - `ManufacturerPartNo` – Combination of `ManufacturerCode` and `ManufacturerPartNo` must be unique - `PartNo` – Product identifier - `Status` – Product status enum - `Type` – Product type enum For **updating** products the required fields are: - `PartNo` – SKU identifier ### Examples in Postman - [ImportProducts examples](https://documenter.getpostman.com/view/2973406/2sA35MzJve#3cb22f1f-ed7c-4625-9bea-517d9b4d8929) ### Examples in Client Libraries details summary Here is a code example using .net client library ```csharp //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.ManufacturerCode, ProductField.Variants, ProductField.Cultures, ProductField.Categories }, ProductCultureFieldsThatAreSet = new List { ProductCultureField.Name, ProductCultureField.Description, ProductCultureField.Title }, VariantFieldsThatAreSet = new List { VariantField.ManufacturerPartNo, VariantField.Skus }, VariantCultureFieldsThatAreSet = new List { }, SkuFieldsThatAreSet = new List { SkuField.Status, SkuField.Type, SkuField.VatRate }, SkuCultureFieldsThatAreSet = new List { SkuCultureField.ErpName, SkuCultureField.Comment }, SkuPriceListFieldsThatAreSet = new List { }, IgnoreSkuPriceListFieldsWhenEmpty = new List { }, SkuStructureItemFieldsThatAreSet = new List { } }; var requestUri = new Uri(new Uri(serviceUrl), "product/ImportProducts"); var myRequest = new MyRequest(productHeader, GetProducts()); return RestHelper.SendStreamedData( requestUri.AbsoluteUri, applicationId, secretKey, myRequest); } private static IEnumerable GetProducts() { // NOTE Format and map your data to the Norce Commerce Connect standard here return new List { new Product { ManufacturerCode = "MFR0000001", // NOTE Required key Variants = new List { new Variant { ManufacturerPartNo = "MFRPARTNOTEST01", // NOTE Required key Skus = new List { new Sku { PartNo = "TESTSKU01", // NOTE Required key Status = SkuStatus.Active, // NOTE Required key Type = SkuType.Standard, // NOTE Required key VatRates = new List { new VatRate { Rate = 25.00M, SalesArea = SalesArea.Sweden } }, Cultures = new List { new SkuCulture { CultureCode = "sv-SE", ErpName = "ERP Name", Comment = "Comment" } } } } } }, Cultures = new List { new ProductCulture { CultureCode = "sv-SE", Name = "Name", Description = "Description", Title = "Title" } }, Categories = new List { new ProductCategory { Code = "CAT001", SortOrder = 1 } } } }; } ``` ## ImportOnhands [ImportOnhands](/api-reference/connect/productservice/openapi/product/importonhands) is used to update on hand data for SKU´s, keys are: - `PartNo` – Product identifier - `WarehouseCode` – Warehouse identifier - `LocationCode` – Warehouse location identifier Note SKU, Warehouse and Location must already exist in Norce Commerce, if not – data is ignored. ### Examples in Postman - [ImportOnHands examples](https://documenter.getpostman.com/view/2973406/2sA35MzJve#d7cbb331-5fdf-4a07-aa6f-2f853d60599c) ### Examples in Client Libraries details summary Here is a code example using .net client library ```csharp //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() { // 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( onhandHeader, GetOnhands()); return RestHelper.SendStreamedData( requestUri.AbsoluteUri, applicationId, secretKey, myRequest); } private static IEnumerable GetOnhands() { // NOTE Format and map your data to the Norce Commerce Connect standard here return new List { 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](/api-reference/connect/productservice/openapi/product/importskupricelists) is used to update pricing data for Products (SKUs), keys are: - `PartNo` – Product identifier - `PriceListCode` – Price list identifier (called `Agreement` in Query) - `QuantityBreak` – Usually 1, quantity break defines at which customer order value a certain price is active. Note The Product and Price list must already exist in Norce Commerce, if not – data is ignored. ### Examples in Postman - [ImportSkuPriceLists examples](https://documenter.getpostman.com/view/2973406/2sA35MzJve#9b0876d3-521a-487a-ad2b-5ac63b37727d) ### Examples in Client Libraries details summary Here is a code example using .net client library ```csharp //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() { // 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( priceListHeader, GetPriceLists()); return RestHelper.SendStreamedData( requestUri.AbsoluteUri, applicationId, secretKey, myRequest); } private static IEnumerable GetPriceLists() { // NOTE Format and map your data to the Norce Commerce Connect standard here return new List { 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 - [Job](/developer-portal/system-integration/job-check-examples) - Product (this) - [Supplier](/developer-portal/system-integration/supplier-integration-examples) - [Customer](/developer-portal/system-integration/customer-integration-examples) - [Calling Norce Commerce Connect](/developer-portal/system-integration/calling-norce-commerce-connect) - [Product and pricing integrations](/developer-portal/system-integration/products-and-pricing-integrations) - [Product integration scenarios](/developer-portal/system-integration/product-integration-scenarios)