REST Overview Novel


(Olga Klimova) #41

It maybe issue with limited count of records that return by default.

Try to add
key=“DefaultMaxRowCount” value=“0” into web.config appSettings section.


(Joshua Giese) #42

I figured out a workaround. I can’t use Labor BO to query LaborDtl. I can’t use LaborDtl becuase it’s depricated. I had to use instead the LaborDtlSearches and that was ok. Contract.Labor in BL tester I get what I need but something in the API is goofy with that one. Oh well got a workaround none the less.


(Stephen Booth) #43

I have a certificate setup and successfully in use, and we just checked the checkbox for REST, but we’re getting a 500 Internal Error trying to perform any task through REST. Even in swagger, if I click the link to any of the services I get this:

500 : Sorry! Something went wrong. Please contact your system administrator. https://ourserver/ourapp/api/swagger/v1/odata/Erp.BO.ABCCodeSvc


(Jose C Gomez) #44

Can you browse the help page?
https://YourServer/YourShare/api/help


(Stephen Booth) #45

Yes, I can, and I get the list of services and all, but as soon as I click on the service to view the details that 500 error is what I receive.


(Jose C Gomez) #46

What do you see in your EventViewer on the server side?


(Stephen Booth) #47

Nothing of significance. I’ve even run this from the server, and I get the same error, but nothing in the event viewer. This is what I get in the server trace log (after enabling logging for rest).


(Stephen Booth) #48

I should note I have Windows Authentication enabled on the instance web site. I was trying to get SSO working. If I turn off Windows Authentication I receive the same error from swagger on the ABCCodeSvc web page, and the same error in the trace log, just with the Auth Header scheme changed to Basic.


(Jose C Gomez) #49

Try creating a WindowsChannel App Server and using it there… I suspect the SSO/WindowsAuth stuff is causing issues.


(Stephen Booth) #50

We’re currently using a Windows Channel app server. That’s why I tried using SSO. I’ll try setting this up in another environment. Maybe something went awry during initial installation.


(Stephen Booth) #51

After creating a completely new app pool, I’m getting the following errors in event viewer now when I try to get to the ABCCodeSvc in Help:

ERROR 1:

Epicor.RESTApi.ErrorHandling.ApiException: Incorrect service name. Example: Ice.BO.TipSvc
at Epicor.RESTApi.Misc.RouteMapping.GetTypeMappingFromPath(String svcName) in c:_Releases\ICE\3.1.500\Current\Source\Framework\Epicor.RESTApi\Misc\CommonFunctions.cs:line 43
at Epicor.RESTApi.ODataHelpers.v3.RouteHelper.BoServiceModel(HttpRequestMessage request, String[] segments) in c:_Releases\ICE\3.1.500\Current\Source\Framework\Epicor.RESTApi\ODataHelpers\v3\RouteHelper.cs:line 107
at Epicor.RESTApi.ODataHelpers.v3.CustomODataPathRouteConstraint.Match(HttpRequestMessage request, IHttpRoute route, String parameterName, IDictionary`2 values, HttpRouteDirection routeDirection) in c:_Releases\ICE\3.1.500\Current\Source\Framework\Epicor.RESTApi\ODataHelpers\v3\CustomODataPathRouteConstraint.cs:line 69
at System.Web.Http.Routing.HttpRoute.ProcessConstraint(HttpRequestMessage request, Object constraint, String parameterName, HttpRouteValueDictionary values, HttpRouteDirection routeDirection)
at System.Web.Http.Routing.HttpRoute.ProcessConstraints(HttpRequestMessage request, HttpRouteValueDictionary values, HttpRouteDirection routeDirection)
at System.Web.Http.Routing.HttpRoute.GetRouteData(String virtualPathRoot, HttpRequestMessage request)
at System.Web.Http.HttpRouteCollection.GetRouteData(HttpRequestMessage request)
at System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Web.Http.HttpServer.d__0.MoveNext()

ERROR 2:

System.NullReferenceException: Object reference not set to an instance of an object.
at Swashbuckle.Application.SwaggerDocsConfig.GetSwaggerProvider(HttpRequestMessage swaggerRequest)
at Swashbuckle.Application.SwaggerDocsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpMessageInvoker.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Web.Http.HttpServer.d__0.MoveNext()


(Jose C Gomez) #52

Have you tried another Service? I had issues with 1 service but everything else worked fine


(Stephen Booth) #53

Every service I try produces the same result. What is odd, if I go to the BAQ section for the help it is able to “autofill” the BAQ Name field with our BAQs. So I can start typing in the field and it retrieves the list of BAQs that match what I typed in. I’m assuming those are built as needed and aren’t built at application pool startup.


(Stephen Booth) #54

Not sure what I did (just kept trying) now my API calls work. The help still performs the same (errors), but my API calls work.


(Olga Klimova) #55
> open your web.config, find the following line
> <runtime>
> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
> <probing privatePath="Assemblies/WebApi" />



> and add these string after it:

> <dependentAssembly>
> <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
> <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
> </dependentAssembly>
> <dependentAssembly>
> <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
> <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
> </dependentAssembly>

(Adam Nofsinger) #56

Are the RESTful APIs the reason behind adding all of these new Endpoint bindings that I didn’t see in Epicor 10.0? HttpBinaryUsernameSslChannel, HttpsBinaryWindowsChannel, etc?

If not, any idea what these are for and how they differ from the ones we had in Epicor 10.0?


(Jose C Gomez) #57

I believe that most of these are for HTTPS deployments over the WAN… (Think SaaS)


(Olga Klimova) #58

REST does not use these endpoints,
They are for WCF clients.
Difference from e10.0 is these new endpoints are based on http, not on tcp.


(Bart Elia) #59

Olga is correct. REST does not use WCF and is pure vanilla http(s).


(Lee Fry) #60

Hey Guys,

I have been playing around with this REST custom methods stuff but I can’t seem to figure out the whereClause part, for instance how would I get a list with all parts that start with or equals CMD1 etc

I have tried guessing the syntax such as whereClause : “{“PartNum”:“CMD1”}” but this is more mongodb style than anything .

I cant seem to find the appropriate help document for this whereClause so if anyone can point me in the right direction it’ll be much appreciated?

Many Thanks
Lee