Developer forum

Forum » Feature requests » Paginated results in dwapi get carts

Paginated results in dwapi get carts

Theodor Perrier
Reply

The endpoint GET /dwapi/ecommerce/carts returns a list of UserCartsResponse, but the endpoint is paginated and the response doesnt respond with a paginated result i.e.
list of results, totalpages. total in result.

It would be preferred to have that info as well.

Regards

Theodor


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Theodor.

I can give you that - the response could benefit from having an encapsulating viewmodel containing information about totals.

I have created a new endpoint, GET dwapi/ecommerce/carts/list, devops#14646 that returns a list object with paging information:

https://dev.azure.com/dynamicwebsoftware/Dynamicweb/_git/Dynamicweb/pullrequest/9486

public class UserCartsListResponse
        {

            /// <summary>
            /// Gets or sets the items count per page.
            /// </summary>
            public int PageSize { get; set; }

            /// <summary>
            /// Gets or sets the count of pages.
            /// If this value is greater than 0, the view model result will be paginated, otherwise, plain list.
            /// </summary>
            public int PageCount { get; set; }

            /// <summary>
            /// Gets or sets the current page number.
            /// </summary>
            public int CurrentPage { get; set; }

            /// <summary>
            /// Gets or sets the total number of orders in the list.
            /// </summary>
            public int TotalCartsCount { get; set; }

            /// <summary>
            /// Gets or sets the list of carts, see <see cref="UserCartsResponse"/>
            /// </summary>
            public List<UserCartsResponse> Carts { get; set; }
        }

 
Theodor Perrier
Reply

Awesome, looks exactly like the funktionality i needed.

Thanks for the quick reply and addition to the code base, i'll look out for the next release after the merge.