cancel
Showing results for 
Search instead for 
Did you mean: 

/api/people retruens only 5000 users

diptikulkarni
Champ in-the-making
Champ in-the-making
hi , we have around 1 lac users users defined in Alfresco, and when we use api for people, we get only 5k users.
Is it possible to get all users using some pagination parameter in API? couldnt find much online, and people talked about making backed change to Alfresco server.
Please help.
3 REPLIES 3

jm_pascal
Star Contributor
Star Contributor
Aloah,

You need to use the parameter maxResults like below

 
GET alfresco/service/api/people?maxResults=1


Hope it helps.

Thanks for your reply Aloah, Even after using maxResults=5000, we still gets  1k users in the result. i also found some one talked about changing the defaultListMaxResults in peoplescript bean like mentioned here http://stackoverflow.com/questions/18155016/alfresco-api-service-people-only-returns-5000-results-in...

Can you let us know how this should be done, and whether this is the only way to get all users

deepak1987
Star Contributor
Star Contributor
Hi Dipti,

You need to make the following changes in order to get userList > 5000 in the result:

defaultListMaxResults property value is hard-coded to 5000 in peopleScript bean (org.alfresco.repo.jscript.People) so even if you pass maxResults=6000 in the Webscript, it will return MAX 5000 only.

Override following bean by setting 'defaultListMaxResults' property value to 10000 or more and put this bean entry in  your custom context XML file like /tomcat/shared/classes/alfresco/extension/custom-script-services-context.xml and Restart the Alfresco instance.

And use following URL to get all the users from DB:
http://localhost:8080/alfresco/service/api/people

If you pass 'filter' parameter in the URL then it will get Users by SOLR query which will return MAX 1000 users.  
http://localhost:8080/alfresco/service/api/people?filter=*
OR
http://localhost:8080/alfresco/service/api/people?filter=NON_NULL



<bean id="peopleScript" parent="baseJavaScriptExtension" class="org.alfresco.repo.jscript.People">
        <property name="extensionName">
            <value>people</value>
        </property>
        <property name="storeUrl">
            <value>${spaces.store}</value>
        </property>
        <property name="serviceRegistry">
            <ref bean="ServiceRegistry"/>
        </property>
        <property name="authorityDAO">
            <ref bean="authorityDAO"/>
        </property>
        <property name="authorityService">
            <ref bean="AuthorityService"/>
        </property>
        <property name="personService">
            <ref bean="PersonService"/>
        </property>
        <property name="authenticationService">
            <ref bean="AuthenticationService"/>
        </property>
        <property name="contentUsageService">
            <ref bean="ContentUsageService"/>
        </property>
        <property name="tenantService">
            <ref bean="tenantService"/>
        </property>
        <property name="userNameGenerator">
            <ref bean="userNameGenerator"/>
        </property>
        <property name="userRegistrySynchronizer" ref="userRegistrySynchronizer" />
        <property name="honorHintUseCQ">
            <value>${people.search.honor.hint.useCQ}</value>
        </property>
      
         <!– NEW property added to set the defaultListMaxResults value –>
        <property name="defaultListMaxResults">
            <value>10000</value>
        </property>
         
    </bean>