I have an issue regarding pagination for some REST endpoints. For example HTTP GET requests against the api/v2/odata/<company>/Ice.BO.ZDataTableSvc/ZLookupLinks endpoint:
[skip=0, top=1000000] => 3092 unique records
[skip = 0, top = 1] => empty array
[skip = 0, top = 19] => empty array
[skip = 0, top = 20] => one record
[skip = 0, top = 28] => two records
[skip = 1, top = 28] => one record
If I were to use a fixed page size and offset value, that would result in skipped records when trying to read the whole table.
I think I can get all the records when not using a fixed increment for $skip but rather the total number of records received so far. But there are two issues with that approach:
When to stop? If an empty array is received was that the last page or there are more and need to keep asking for consecutive pages?
The framework we are using doesn’t have support for dynamic calculation of the paging offset
I’ve tried multiple $orderby setups, but it didn’t seem to have any effect.
This isn’t true for all endpoints, some (eg. Ice.BO.ZDataTableSvc/ZDataTables) seem to return as many records as specified in $top for not last pages.
Context:
We have a platform capable of blending data from multiple ERP systems and we would like to add support for Epicor as well. We are looking for a way we could read data from Epicor systems. A solution that would work more or less out of the box on most Epicor installations would be preferred. So using BAQ over the generic REST may be not a good option for us.
I have to admit I have zero Epicor related knowledge. I don’t even know what a BAQ is, but noticed a few recommendations on this forum to use BAQs over the generic REST API.
Step back and give us the full picture of what you want to do.
Cool, I can use this new template →
To help the community provide the best answer, could you include as much of the information below as you can? Your question appears to be lacking some much needed context
Epicor Version
Deployment Type (Cloud, On Prem, 3rd Party Cloud etc)
The business problem you’re trying to solve
What you’ve already tried
Is this a Kinetic UX (Web) or Epicor Classic issue?
Is it related to a Method Directive, Data Directive, Function, BAQ, UBAQ, Configurator, etc.?
Any screenshots, error messages, or logs.
Any code you’ve written (or borrowed , make sure it is property formatted)
```
code here
```
This may be a good place to start before ruling the BAQ out.
The Business Activity Query is, at its heart, a SQL builder tool. Most newcomers to Kinetic tend to say, “I don’t need that. I know SQL!” But the BAQ does more than just create SQL queries. It also takes care of some security items: straight SQL does not respect field security, site security, company security, or territory security. A BAQ will add that security for you. BAQs are used throughout the UI where an external SQL query is more limited - especially if you’re in the cloud. A BAQ can be parametrized given you flexibility.
As Kevin mentioned, the OData interface is a wrapper around the business objects. Some of these, well, work better than others, as you’ve noticed. The BAQSvc allows you to bring down only the fields you want, create calculated fields to reduce client-side work, can move more records than the standard Odata calls, and has been quite reliable.
Epicor version: Wanted to include this in the original post, but TBH I don’t know and also don’t know how to get it. Have searched for it but all the solutions rely on having some kind of access I don’t have. We are a 3rd party team having API access to an on-prem Epicor system. I haven’t been able to find any way to get the version through the API.
Will ask our contact person, and update the original post.
Deployment: On-prem, but would love to have a solution working for all deployment types.
We can read the data we would like by a direct read-only DB connection. But would like to expand our solution to other potential clients using Epicor. We think relying on direct DB access could be a show-stopper at some places and using the API could be a better approach.
But yes, the version would be helpful, in case there is some problem with it, because as I said above, I am not seeing the same results.
You are absolutely correct here, because for any SaaS customers, if they has not purchased an add on package that provides read only SQL Access, you must use the api, or create some helpers.
The case is still alive from my side, but I haven’t been able to actively chase it in the last couple of weeks. I am picking it up again now, but first I would like to get a bit more familiar with the system as a whole.
Will update this thread once there is progress worthy of posting.