V3 Release Major Update
This release V3 3.0.0.0 contains breaking changes from prior versions as outlined below
The biggest change in this version other than a few bug fixes is to pivot the library to be Instance friendly instead of static. The static approach while it simplified some things it made some other things quite difficult. In order to keep backwards compatibility we still have a static wrapper which should function the same as it always has, below is a breakdown of changes and how to Upgrade easily. This request came from @HLalumiere but also several other users and I have myself encountered issues with this limitation.
- EpicorRest and EpicorRestV1 are now instance classes and should be instanciated as follows
EpicorRest myEpicorRestInstance= new EpicorRest();
myEpicorRestInstance.AppPoolHost = "subdomain.domain.tld"; //TLD to your Epicor Server
myEpicorRestInstance.AppPoolInstance = "EpicorDemo700"; //Epicor AppServer Insdtance
myEpicorRestInstance.UserName = "epicor"; //Epicor Username
myEpicorRestInstance.Password = "epicor"; //Epicor Password
myEpicorRestInstance.APIKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; //API key required with V2
myEpicorRestInstance.Company = "EPIC03"; //Epicor Company (Current company) Required with V2
myEpicorRestInstance.APIVersion = EpicorRestVersion.V2; //Defaults to V2
myEpicorRestInstance.License = EpicorLicenseType.Default; // You can select the type of license you want to use for the call.
The above approach allows you to have multiple instances of EpicorRest without stepping on each other, it also allows you to maintain multiple Sessions.
2. When instantiating a Session you now need to pass in the instance you’d like to associate with the session as shown below
EpicorRest myEpicorRestInstance= new EpicorRest();
//snip....
using (EpicorRestSession ses = new EpicorRestSession(myEpicorRestInstance))
{
var smsSend = new
{
ToPhone = "90445555555",
ToMsg = "Rest is so Cool!"
};
var rsp = EpicorRest.EfxPost("FacilityPaging", "SendSMS", smsSend);
}
Again this allows you to have multiple instances and multiple sessions going at once.
- When instanciating CallContext you’ll also have to pass in the instance because the client contains information like username company etc.
EpicorRest myEpicorRestInstance= new EpicorRest();
//snip....
CallContextHeader callContext = new CallContextHeader(myEpicorRestInstance);
The above change also hilights a new class that was added to the project called EpicorCommon which is inherited by both EpicorRestV1 and EpicorRestV2 so each of these instances is in fact an instance of EpicorCommon
4. EpicorRestStaticWrapper class was created as a static wedge instance for backwards compaitbility. To easily upgrade any project without making any changes simply replace EpicorRest.XX with EpicorRestStaticWrapper.EpicorRest.XX and it should be seemless.
EpicorRestStaticWrapper.EpicorRest.AppPoolHost = TestContext.Properties["AppPoolHost"].ToString();
EpicorRestStaticWrapper.EpicorRest.AppPoolInstance = TestContext.Properties["AppPoolInstance"].ToString();
EpicorRestStaticWrapper.EpicorRest.UserName = TestContext.Properties["UserName"].ToString();
EpicorRestStaticWrapper.EpicorRest.Password = TestContext.Properties["Password"].ToString();
EpicorRestStaticWrapper.EpicorRest.Company = TestContext.Properties["Company"].ToString();
EpicorRestStaticWrapper.EpicorRest.CallSettings = new CallSettings(EpicorRestStaticWrapper.EpicorRest.Company, TestContext.Properties["Plant"].ToString(), "", "");
EpicorRestStaticWrapper.EpicorRest.APIKey = TestContext.Properties["APIKey"].ToString();
EpicorRestStaticWrapper.EpicorRest.APIVersion = EpicorRestVersion.V2;
EpicorRestStaticWrapper.EpicorRest.License = EpicorLicenseType.Default;
With this version we also added a full test suite which should help with regression testing.
- Updated GetEnvironment to work with both version <=2024.1 >=
.NET Framework: NuGet Gallery | EpicorRestAPI 3.0.0
.NET Core 6+ NuGet Gallery | EpicorRESTAPICore 3.0.0
.NET Standard 2.1 NuGet Gallery | EpicorRESTAPIStandard 3.0.0