6

I'm using a REST api to get data from the User Information List using

    https://servername/sitename/_api/Web/SiteUserInfoList/items

This works great but the list stops after 121 entries - ending with a line such as

    <link rel="next" href="https://servername/sitename/_api/Web/SiteUserInfoList/items?%24skiptoken=Paged%3dTRUE%26p_ID%3d2102" /> 

How should I go about calling the entire list?

Maureen
  • 697
  • 1
  • 5
  • 23

2 Answers2

10

Some options to do this:

  1. Use Listdata.svc:
    http://SiteURL/_vti_bin/listdata.svc/UserInformationList. This returns all the items.
  2. Use $top=5000:
    http://SiteURL/_api/Web/SiteUserInfoList/items?$top=5000. This will return all items within the threshold limit.
  3. Use GetItems
    This is a POST request where you can use an empty CAML query to return all the items. Please note that JSON format is default for this and it won't return in XML.

    Request would be like below:

    URL:
    http://SiteURL/_api/Web/lists/getbytitle('User Information List')/getitems

    Headers:
    Accept: application/json; odata=verbose X-RequestDigest: RequestDigest Content-Type: application/json; odata=verbose
    CAML query:
    { "query" : {"__metadata": {"type": "SP.CamlQuery" } , "ViewXml": "<View><Query></Query></View>" } }
Akhoy
  • 2,911
  • 2
  • 18
  • 28
  • Using getbytitle() isn't a sure thing here because the list can be renamed (and possibly has different default names in other localities). – JLRishe Jul 05 '19 at 01:41
  • @JLRishe you can use the endpoint http://siteURL/_api/web/SiteUserInfoList/items then – Akhoy Jul 05 '19 at 06:46
0

header must be included

Accept: application/json; odata=verbose
Content-Type: application/json