I’m working with Dynamics 365 9.1 On-Premises and setting up a Virtual Entity connected to an external OData v4 API. The goal is to use server-side paging. The API can accept query parameters (skip and top), but I’m running into issues:
When I pass parameters like [FromQuery] int? skip and [FromQuery] int? top, no data is retrieved.
If I assign default values to these parameters (e.g., skip = 0 and top = 10), the API only retrieves the default number of records, ignoring changes to the skip and top values sent by Dynamics.
Here’s a simplified version of my API method:
[HttpGet]
public async Task<ActionResult<List<UserCertificatesDto>>> Get([FromQuery] int? skip , [FromQuery] int? top )
{
int skipValue = skip ?? 0;
int topValue = top ?? 10;
var certificates = await _userCertificates.GetAllByPage(skipValue, topValue);
return Ok(new
{
value = certificates,
totalRecordCount = certificates.Count,
hasMoreRecords = (skipValue + topValue) < certificates.Count
});
}
What I’ve Done So Far:
Configured the Virtual Entity Data Source to enable Server-Side Paging.
Tested the API independently with Postman, and it works as expected when passing skip and top query parameters.
Verified the Virtual Entity fields match the API attribute names.
Problem:
When I set up the Virtual Entity to use server-side paging and pass skip and top parameters, the API does not retrieve the expected data. It only retrieves the default value or fails to retrieve any data.
How does Dynamics 365 pass paging parameters (skip, top) to the API?
Is there any special configuration required to ensure they are handled correctly?
Can Dynamics 365 Virtual Entities use APIs that depend on query parameters for paging?
Are there specific considerations for Dynamics 365 9.1 On-Premises regarding OData pagination with Virtual Entities?
Ahmed Hamdy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.