Some REST Erp.BO entities return no data when it seems obvious that they should

Erp.BO.SalesOrderService/OrderMscs service (Using Swagger) returns 0 records when I’ve only specified $top to be 10. I’d expect to get things back that are in the OrderMsc table (of which there are many).

Erp.BO.MiscShipSvc/MiscShips is stranger. While most of the data I get from the REST service matches what I’m seeing in the test EPICOR environment, this service returns a record where PAckNum eq 10000 but no records where PackNum eq 186556. However in the SQL Server:

SELECT TOP 10 * FROM [Epicor10TST].[Erp].[ShipMisc] where PackNum = 186556 

– works, but no data in REST interface

SELECT TOP 10 * FROM [Epicor10TST].[Erp].[ShipMisc] where PackNum = 10000

– doesn’t work, but has data in REST interface

Are there bad or missing Views? What am I missing?

Perhaps the context of your company\site is affecting the results?

1 Like

MiscShipSvc doesn’t get it’s data from Erp.ShipMisc. MiscShipSvc gets it’s data from Erp.MscShpHd so that’s why you are not getting the results you are expecting.
If you want to get Erp.ShipMisc data via REST then you can use the CustShipSvc.

For OrderMscs, it looks like there might be a bug in the $top for this one. I think it works with no $top at all or if you put value of 100 or greater in the $top field.

2 Likes

Also, is there a mapping of the services to the tables documented somewhere?

Thank you! This helped so much. I’ve taken OrderMscs bug up with EPICOR. Apparently you can select $top=1000, but as soon as you add a filter to it, it stops working again.

Not sending $top, or sending $top=101 doesn’t work for me either.

Other variations of OrderMscs are failing (not related to $top) and I wonder if I have an index issue?

My Call:
/api/v1/Erp.BO.SalesOrderSvc/OrderMscs(kmc67230,229474,0,1)

Response:

{
  "HttpStatus":404,
  "ReasonPhrase":"REST Api Exception",
  "ErrorMessage":"Entity OrderMsc with specified keys is not found",
  "ErrorType":"Epicor.RESTApi.ErrorHandling.ApiException"
}

Like maybe some field isn’t part of the built key. Missing Index?


My call:
/api/v1/Erp.BO.SalesOrderSvc/OrderDtls(kmc67230,229474,0)/OrderMscs

Response:

{
      "odata.metadata": "[redacted]/api/v1/Erp.BO.SalesOrderSvc/$metadata#Epicor.RestApi.OrderMscs",
      "value": []
}

When I post:

curl -X POST --header 'Content-Type: application/json' --header 'Accept: text/plain' -d '{ \ 
   "Company": "kmc67230", \ 
   "OrderNum": 231475, \ 
   "OrderLine": 0, \ 
   "SeqNum": 1, \ 
   "MiscCode": "EXP", \ 
   "Description": "Expedite Fee", \ 
   "MiscAmt": "25", \ 
   "DocMiscAmt": "25", \ 
   "FreqCode": "F", \ 
   "Linked": false, \ 
   "ChangedBy": "WooCommerce", \ 
   "ChangeDate": "2019-05-23", \ 
   "Type": "A" \ 
 }' '[redacted]/api/v1/Erp.BO.SalesOrderSvc/OrderMscs'

Response:

{
  "HttpStatus":404,
  "ReasonPhrase":"REST Api Exception",
  "ErrorMessage":"Entity OrderMsc with specified keys is not found","ErrorType":
  "Epicor.RESTApi.ErrorHandling.ApiException"
}

Again, maybe a missing key?

Rick, what user did you connect to for the REST api. The api help page infers the last logged into as the company / plant combination. I would login to Epicor with the same user account as the REST api and then verify this account is in the company and plant of the record you are searching for and the close Epicor.

Retry your query once this is done and let me know if it works.

Example of what is possibly happening.
Say I login to account ‘myaccount’

Last time i was in ‘myaccount’ and i closed Epicor i was in Company 1, Plant A

Later that day I go to the REST api help page and send my credentials for ‘myaccount’

I go to api/help/odata/Erp.BO.SalesOrderSvc/index#!/OData/getRows_OrderMscs1
and run a query with {Company = 2, OrderNum = 123, Line = 10}

Because the api does not specify the company and plant I am running this query from so itassumes I am in Company 1, Plant A by default (as documented in the help docs) as this is what my user file says I was last in…

Therefore the query does not match any records and it appears as if there are no matches, when my database shows clearly that there are.

1 Like

That’s good information. I don’t know if there’s more than one company on the test server, but I’ll find out and make sure I have those ducks in a row.