4

Can't seem to get paging working using the 2013 syntax:

_api/web/GetFolderByServerRelativeUrl('/sites/Test1/Documents')/Files?$skiptoken=Paged=TRUE&p_ID=5&$top=1

The top parameter is working but not the skiptoken.

3 Answers 3

3

There is no skiptoken, there is a skip token in the documentation

Search has different syntax

iREST iDOC

6
  • when using skip instead of skiptoken i get this error "The $skip expression "Paged=TRUE" is not valid."
    – Lior Gal
    Commented Mar 21, 2017 at 7:30
  • Hmm.. then the Documentation where you read this syntax is wrong ?? ... weird... usually the manuals are correct, most of this has been around for 7 years or so. Where did you read this syntax ?? Commented Mar 21, 2017 at 8:19
  • On several forums but there all talking about REST for sp 2013, im using sp 2016 online working with the new SPFX
    – Lior Gal
    Commented Mar 22, 2017 at 8:51
  • So you now conclude Microsofts (2013) REST Documentation does not apply to 2016? Commented Mar 22, 2017 at 12:39
  • 1
    The second link you give specifies that SkipToken is the way to do paging, but that's only for some SharePoint OData sources, which the documentation doesn't specify Commented Mar 23, 2017 at 9:32
2

_api/web/GetFolderByServerRelativeUrl('...')/Files doesn't support $skiptoken option use the standard $skip option

SharePoint OData REST Queries has two "Skip" options for Paging

  • $Skip
  • $SkipToken

$Skip

$Skip is the simple and standard OData way of implementing Paging it just specifies how many items to skip.

If you're paging 15 items/files/... at a time then you specify:

$top=15&$skip=0 to get the page 1
$top=15&$skip=15 to get the page 2
$top=15&$skip=150 to get the page 11

Pros

  • Standard OData so should work with any OData "sources"
  • Simple
  • You don't have to visit prior pages to get/calculate value

Cons

  • Not "solid": Paging through list may
    • give same item on two pages if other item is inserted prior to it in used sort order
    • miss an item if other item is deleted prior to it in used sort order

$SkipToken

The "solid" paging option implemented by some SharePoint OData "sources". The format of the token is complex and not something you should ever construct yourselves:

$top=10&$skiptoken=Paged%3dTRUE%26p_SortBehavior%3d0%26p_ID%3d10 to get page 2

Don't try to construct it yourselves. Always use href from <link rel="next" ... /> from prior "page".

Pros

  • "Solid": Items returned not depend on insert/delete of other items
  • Implemented using standard REST link rel="next"

Cons

  • Not working with a lot of OData "sources"
  • You have to visit pages in order
5
  • $top doest work: The expression "web/GetFolderByServerRelativeUrl('/sites/Test1/Documents')/Files$top=15&$skip=0" is not valid. </m:message> </m:error>
    – Lior Gal
    Commented Mar 23, 2017 at 15:43
  • You're missing a ? in from of the querystring parameters: web/GetFolderByServerRelativeUrl('/sites/Test1/Documents')/‌​Files?$top=15&$skip=0‌​ Commented Mar 24, 2017 at 9:45
  • strill iget the files as i indicated in the top parameter but it always begin at the first file meaning the skip parameter have no effect.
    – Lior Gal
    Commented Mar 26, 2017 at 12:38
  • $skip=0 means skip nothing have you tried $skip=15? Commented Mar 26, 2017 at 14:10
  • Yep i did, same result
    – Lior Gal
    Commented Mar 27, 2017 at 11:55
0

The skiptoken parameter in rest call works only on Lists/Libraries but not on relative path. Try the following url it works

/sites/Test1/_api/web/getByTitle('Documents')/Items?$skiptoken=Paged=TRUE&p_ID=5&$top=5
3
  • i get "Cannot find resource for the request getByTitle"
    – Lior Gal
    Commented Mar 23, 2017 at 15:40
  • use this syntax please, "/sites/Test1/_api/web/Lists/getByTitle('Documents')/Items?$skiptoken=Paged=TRUE&p_ID=5&$top=5" Commented Mar 23, 2017 at 15:43
  • what is p_ID in this?
    – Jahangeer
    Commented Mar 28, 2022 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.