Hi Guys,
Recently I got a chance to work with Episerver Commerce Service API to import the Catalogs and Products from XML to the Commerce manager.
Episerver provided very detailed documentation for the APIs so you will not face issues while working with these APIs.
Still, I am sharing some issues while configuring the Episerver Commerce Service API and while importing the data to the Commerce manager.
Episerver provided very detailed documentation related to installation. You can find it here
Token route (/episerverapi/token) returns 404 - You may face one issue related to OWIN startup and because of this your Token route (/episerverapi/token) returns 404. Its a common issue that lots of developers while working with service APIs.
Fix – While Configuring OWIN startup class make sure you put initial it with
[assembly: OwinStartup(typeof(Test.Web.Startup))]
using EPiServer.ServiceApi.Owin;
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(Test.Web.Startup))]
namespace Test.Web
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
// Enable bearer token authentication using Membership for Service Api
app.UseServiceApiMembershipTokenAuthorization();
}
}
}
<add key="owin:AppStartup" value="Web.Startup, Web" />
<add key="owin:AutomaticAppStartup" value="true" />
FYI – After adding this class or settings in web.config make you reset your IIS or try running your solution in debug mode(Press F5) because sometimes your site did not detect these changes and you will still face the same issue.
You may face some common issues and Māris already written a great article here on it.
Update Service API issue – As you all know Episerver exposed a list of endpoints for performing the CRUD operations (here) but while using one of its service API endpoints I noticed that it overwrites the data instead of update.
Ex- Like you have a product or node that has Metadata values in multiple languages (en-US, en-CA, etc..) and data is coming from multiple files so in first call it will create the node but when you fetch the node of en-US and try to update it with en-CA language values it creates a new item and put the en-CA language values only.
Fix -
Thanks for reading this blog post I hope it helps
Thanks and regards
Ravindra S. Rathore