2

Are there any URL length limitation when making a GET request using REST API to SharePoint? I've been investigating for a while now, all I can see are inconsistent answers.

Microsoft documentation only shows url length limitation when using SharePoint browser. I am currently making an external application that uses REST API calls, but there seems to be a problem with the length of the URL.

  • Get request in what? in list items or others? for list items, there is alternate solution using CAML and POST request – Atish Dipongkor - MVP Sep 21 '16 at 8:16
  • like request for retrieving list of subsites/document libraries/folders/files – buttercup Sep 21 '16 at 9:05
  • See my answer for list and libraries. It is not possible for others AFAIK. – Atish Dipongkor - MVP Sep 21 '16 at 9:09
  • Can you post an example for subsite which is exceeding the default limit? – Atish Dipongkor - MVP Sep 21 '16 at 9:20
  • Structure is like this: /<very long subsite path>/_api/web/GetSubwebsFilteredForCurrentUser(nwebtemplatefilter=-1)?$select=Title,ServerRelativeUrl&$skip=0&$top=50. – buttercup Sep 21 '16 at 9:26
0

Default GET request URL length is 260. It can be modified in on-premise but in online it is not possible.Follow this link to modify this default value in On-Premise.

If your GET request URL length exceeds for getting items from a list, then you can solve it using CAML query and POST request. Example:

End-point

/_api/Web/Lists/getbytitle('List Name')/GetItems

Request Body

{
  __metadata: {
    type: "SP.CamlQuery" 
  },
  ViewXml: 'CAML Query goes here'
}

Most of the cases, I found URL length exceeds for $filter operator. So $filter can be solved using CAML query.

  • I have tried counting the actual URL length, it is okay until 260 (not including the domain [https://], endpoint [something.sharepoint.com] and OData operators [...?$skip=0,..] – buttercup Sep 21 '16 at 8:57
  • you are right. answer updated – Atish Dipongkor - MVP Sep 21 '16 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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