Skip to content

Contract-Based API pagination parameters ($skip, $top) are ignored due to missing propagation in V 4.0 #67

@mbe14

Description

@mbe14

Pagination does not work when calling GetListAsync on Contract-Based API entities.
Even when $skip and $top are specified, all records are returned.
This appears to be caused by the caller method not forwarding the pagination parameters to ComposeQueryParams.

Example:

EntityAPI_Implementation.cs

protected async Task<ApiResponse<List<EntityType>>> GetListAsyncWithHttpInfo(
            string select = null, string filter = null, string expand = null, string custom = null,
            int? skip = null, int? top = null, Dictionary<string, string> customHeaders = null)
        {
            HttpResponseMessage localVarResponse = await ApiClient.CallApiAsync(
                $"{GetEndpointPath()}/{GetEntityName()}",
                HttpMethod.Get,
                ComposeQueryParams(select, filter, expand, custom), // <- CALLER
                null,
                HeaderContentType.Json,
                HeaderContentType.None,
                customHeaders);

            VerifyResponse(localVarResponse, "GetList");

            return DeserializeResponse<List<EntityType>>(localVarResponse);
        }

Although the method accepts skip and top, these parameters are not passed to ComposeQueryParams, so they never reach the request.

Expected Behavior

When skip and top are provided, the generated request should include:

  • $skip

  • $top

and the API should return only the requested page of records.

Actual Behavior

  • $skip and $top are omitted from the request

  • The API returns all records

  • Client-side pagination loops never terminate

Supporting Evidence

From Acumatica.RESTClient.Api → BaseApi.cs, pagination is clearly supported:

protected List<KeyValuePair<string, string>> ComposeQueryParams(string select = null, string filter = null, string expand = null, string custom = null, int? skip = null, int? top = null)
        {
            var queryParameters = new List<KeyValuePair<string, string>>();
            if (!String.IsNullOrEmpty(select)) queryParameters.AddRange(ApiClient.ParameterToKeyValuePairs("", "$select", select)); // query parameter
            if (!String.IsNullOrEmpty(filter)) queryParameters.AddRange(ApiClient.ParameterToKeyValuePairs("", "$filter", filter)); // query parameter
            if (!String.IsNullOrEmpty(expand)) queryParameters.AddRange(ApiClient.ParameterToKeyValuePairs("", "$expand", expand)); // query parameter
            if (!String.IsNullOrEmpty(custom)) queryParameters.AddRange(ApiClient.ParameterToKeyValuePairs("", "$custom", custom)); // query parameter
            if (skip != null) queryParameters.AddRange(ApiClient.ParameterToKeyValuePairs("", "$skip", skip)); // query parameter
            if (top != null) queryParameters.AddRange(ApiClient.ParameterToKeyValuePairs("", "$top", top)); // query parameter

            return queryParameters;
        }

Suggested Fix

Update the caller to pass skip and top:

ComposeQueryParams(select, filter, expand, custom, skip, top)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions