Open Closed

/api/identity/users returning max 10 records without parameters #938


0
mmorrisset created

Hi, I'm making a call to /api/identity/users without any parameters and only receive 10 records. I've tested via my app UI and swagger. If I set maxResultCount=1000 in swagger, I get all my user records. Previous versions of ABP didn't set this limit by default.

This breaks my user page which now only shows 10 users.

I have custom fields added to my user entity that require me to override the ABP pages for managing users. I am setting my datatable to serverSide:false so my added fields are sortable / filterable.

In my /pages/identity/users/index.js we have:

_dataTable = $('#IdentityUsersWrapper table').DataTable(abp.libs.datatables.normalizeConfiguration({ order: [[2, "asc"]], lengthMenu: [10, 25, 50, 75, 100], processing: true, serverSide: false, searching: true, scrollX: true, paging: true, ajax: abp.libs.datatables.createAjax(_identityUserAppService.getList), //, getFilter), columnDefs: abp.ui.extensions.tableColumns.get("identity.user").columns.toArray() }));

I have tried the following with no luck: // ajax: abp.libs.datatables.createAjax(_identityUserAppService.getList({ maxResultCount: 1000 })), //, getFilter), // ajax: '/api/identity/users?maxResultCount=1000',

How can I update this ajax call to pass the maxResultCount: 1000 to the server? Or how can I get ALL records when calling /api/identity/users ?

  • ABP Framework version: v4.2
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:

3 Answer(s)
  • 0
    maliming created
    Support Team

    hi

  • 0
    mmorrisset created

    Hi, I originally missed the "getFilter" code that gets passed in. With that added, the API now return all my records. Thank you, I can work with this.


    I am curious if it was a design decision to have the API return only 10 records by default. Seems counter intuitive and wasted a good amount of time.

    To reproduce:

    1. Add 11+ users to an ABP site
    2. Hit the API /api/identity/users

    In my case, I have 12 users. Json return shows the correct count but only 10 records are in the items section. {"totalCount":12,"items": [ ONLY 10 RECORDS HERE ]

  • 0
    maliming created
    Support Team

    hi

    It works with the front-end DataTables pagination.

    If your application has hundreds or thousands of users, you don't want to return so much data at once.

    You can also customize a method to return all users.