﻿![]()

#### 

In my previous [blog post](https://www.brimit.com/blog/sitecore-commerce-9-export-price-books), I explained how to implement export Price Books feature.

 Now I am going to explain how to implement import Price Books feature.

Source code you can find here: [https://github.com/Frog911/Sitecore.Commerce.ImportExport](https://github.com/Frog911/Sitecore.Commerce.ImportExport)

First, let’s start from the endpoint implementation.

[![Sitecore Commerce 9: Import Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-3/3.png?w=900&amp;hash=479BAB35FD33A806B6C5D6914C64BE1D)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-3/3.png)

ImportPriceBook action will support some parameters like importFile, errorThreshold, mode and publishEntities. We have to implement ImportPriceBooksCommand, which we will invoke with the ExecuteLongRunningCommand operation. When we will call our custom endpoint for the import process, it can take quite a lot time. It depends how huge is our Price Books will be.

 In our case, ExecuteLongRunningCommand will return an object, which will contain TaskId. Sitecore Commerce provides an endpoint to track the task status.

The implementation of ImportPriceBooksCommand should look like below.

[![Sitecore Commerce 9: Import Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-3/4.png?w=900&amp;hash=2FD3FD392547F113DD0F8726335FE999)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-3/4.png)

Now we have to create custom argument. ImportPriceBooksArgument will be using by custom pipeline to share some data through the pipeline blocks.

[![Sitecore Commerce 9: Import Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-3/5.png?w=900&amp;hash=9D9951DD2CAF526121C85A9D380521D3)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-3/5.png)

Creating pipeline interface and implementing it:

[![Sitecore Commerce 9: Import Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-3/6.png?w=900&amp;hash=BA2FF5997FC86CF1AED9B4F34EAF8624)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-3/6.png)

[![Sitecore Commerce 9: Import Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-3/7.png?w=900&amp;hash=FF8D101326A521D68D1DA3AA46CEBFCC)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-3/7.png)

Let’s update the ConfigureSitecore.cs file with some pipeline registrations.

[![Sitecore Commerce 9: Import Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-3/9.png?w=900&amp;hash=35DA8D3A54F79531831C59866AFEAB96)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-3/9.png)

The implementation of blocks you can find in my GitHub repo with I mentioned above. 

Now everything is ready for testing. Let’s try to call ImportPriceBooks endpoint from Postman.

[![Sitecore Commerce 9: Import Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-3/10.png?w=900&amp;hash=53383B64B89040B4EA418331B0729909)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-3/10.png)

[![Sitecore Commerce 9: Import Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-3/11.png?w=900&amp;hash=C6FC6AB94DE4EDCE78C9E6B985BD2DB2)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-3/11.png)

As you can see, Price Books were imported successfully.

In the next [blog post](https://www.brimit.com/blog/sitecore-commerce-9-extend-bizfx-part-1), I will explain how to extend BizFx interface to support import/export features.

Stay tuned!

###### More from author

[##### Sitecore OrderCloud: Restricting access to a custom middleware endpoints for Anonymous customers
August 13, 2024](https://www.brimit.com/blog/sitecore-ordercloud-restricting-access-to-custom-middleware-endpoints-for-anonymous-customers)[##### Sitecore OrderCloud: Cannot Create a Buyer and a Supplier with the Same ID
March 31, 2023](https://www.brimit.com/blog/sitecore-ordercloud-cannot-create-a-buyer-and-a-supplier-with-the-same-id)[##### Sitecore OrderCloud: How to Start Using “Me and My Stuff”
November 29, 2021](https://www.brimit.com/blog/sitecore-ordercloud-how-to-start-using-me-and-my-stuff)

###### Author

[!\[apaliakou\](https://www.brimit.com/-/jssmedia/feature/blogs/authors/apaliakou.jpg?h=216&amp;iar=0&amp;w=360&amp;hash=5BE96F17AE5B47F66D9F684B87773675)
Andrei Paliakou
Sitecore MVP/ Lead Developer](https://www.brimit.com/blog/author?authors=Andrei%20Paliakou)

###### More By Categories

[#Events](https://www.brimit.com/blog?categories=#Events)[#How-to](https://www.brimit.com/blog?categories=#How-to)[#News](https://www.brimit.com/blog?categories=#News)[#Guides](https://www.brimit.com/blog?categories=#Guides)

###### More by Platform

[Data and AI](https://www.brimit.com/blog?platforms=Data%20and%20AI)[DXP](https://www.brimit.com/blog?platforms=DXP)[E-commerce](https://www.brimit.com/blog?platforms=E-commerce)[Internet of Things](https://www.brimit.com/blog?platforms=Internet%20of%20Things)[Sales and marketing automation](https://www.brimit.com/blog?platforms=Sales%20and%20marketing%20automation)

#### More on Sitecore

[!\[How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2024/vercel_cover-image.png)
#Guides#How-toDXPE-commerce
##### How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects
Optimize and accelerate the development and deployment of complex multisite Sitecore projects.
Alexei Vershalovich on July 17, 2024](https://www.brimit.com/blog/how-vercel-will-help-you-save-effort-when-deploying-sophisticated-sitecore-projects)

[!\[Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2023/sitecore-mentoring---cover-image.png)
#How-toDXP
##### Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story
How to participate in the Sitecore Mentor program and help younger colleagues jump-start a career in Sitecore development.
Sergey Baranov on October 2, 2023](https://www.brimit.com/blog/training-up-tomorrows-sitecore-mvps)

[!\[Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2022/headless/adobestock_456986731.jpg)
#How-toDXPE-commerce
##### Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)
Discover how a headless CMS can benefit organizations that use Sitecore.
Daniil Raschupkin, Palina Trokhautsava on September 15, 2022](https://www.brimit.com/blog/going-headless-part-2-when-a-headless-cms-is-your-best-bet-if-you-have-sitecore)

![](https://bat.bing.net/action/0?ti=187017043&amp;tm=gtm002&amp;Ver=2&amp;mid=8355483a-9783-414e-b4a8-dfb45a4c11ea&amp;bo=2&amp;gtm_tag_source=1&amp;pi=0&amp;lg=en-US&amp;sw=800&amp;sh=600&amp;sc=24&amp;nwd=1&amp;tl=Sitecore%20Commerce%209%3A%20Importing%20Price%20Books&amp;p=https%3A%2F%2Fwww.brimit.com%2Fblog%2Fsitecore-commerce-9-import-price-books&amp;r=&amp;lt=316&amp;evt=pageLoad&amp;sv=2&amp;asc=D&amp;cdb=AQAY&amp;rn=735829)