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.

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

1 Answer 1

1

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.

3
  • 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,..] Sep 21, 2016 at 8:57
  • you are right. answer updated Sep 21, 2016 at 9:01
  • @AtishDipongkor-MVP can you explain how query should be constructed in the viewXml for fields which need to be extended? Sep 18, 2022 at 7:34

Your Answer

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

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