Hi all - I’m pretty new to Epicor, admittedly. I’ve been in my position for about a year now. But I am not new to programming - I’m a 25 year I.T. journeyman coder; I’m pretty familiar with relational data and RESTful APIs.
I don’t understand what the point is of many of these Kinetic REST API routes that suggest they will retrieve collections for you, but you end up getting nothing back. Please note that I am talking about running these routes in the REST API Help pages using the OpenAPI “Try it Out” functionality, so none of this has to do with coding issues on my part.
Here is an example:
I have a Sales Order Number. I want to retrieve the OrderHed record, all the OrderDtls records, and all the OrderRel records in as efficient and performant a manner as possible using the REST APIs. The Erp.BO.SalesOrderSvc API has ostensibly convenient routes that would suggest this is no problem, e.g.:
GET /{currentCompany}/Erp.BO.SalesOrderSvc/SalesOrders
It’s an OData route, so you set a $select list to pare down the inordinate number of fields, and set the $filter to:
“OrderNum eq {someOrderNumber}”
This works just fine. But then to get OrderDtls, you perform the same operation using:
GET /{currentCompany}/Erp.BO.SalesOrderSvc/OrderDtls.
This route’s description says it “Calls GetRows to retrieve OrderDtl items.” So you think this is the same deal - set the parameters, define a $select list, and set a $filter to:
“OrderNum eq {someOrderNumber}”
Except this time the response is:
{ "@odata.context": "https://{someEpicorInstance}/api/v2/odata/LBS/Erp.BO.SalesOrderSvc/$metadata#OrderDtls(OrderNum,OrderLine,OpenLine,PartNum)", "value": [] }
Why? I thought the idea behind the OData routes was that you have great flexibility between $select, $filter, and $expand to specify which data you want, how it’s presented, and even to pull child information. Except the reality I am running into here is that a simple, straightforward query - what would be a 1 line SELECT in a SQL context - requires multiple classes to operate through REST and gets you either no data or, in the case of using $expand, creates an unacceptable processing bottleneck (pulling just the OrderDtls along with the Order header for even a moderately sized order of ~100 sales order lines effectively crashes the call. I waited over five minutes and gave up - no user will - or should! - tolerate that.)
The only way I have found for this to work is to call an additional route from a completely different API - the List route from the Erp.BO.OrderDtlSearchSvc - just to get a list of OrderDtl keys that I can then turn around to retrieve individually. And that’s just one child collection. I still need to get OrderRels, JobProds, JobHeads, JobOpers, JobMtls, POHeaders, PODetails, and PORels. I can code this in async using parallel HTTP calls, but is this really the only way to retrieve these child records?
There has to be a better way. Can anyone explain what I am missing here?