Skip to main content


Showing posts from August, 2015

How to resolve "400 bad request" error in getFolderByServerRelativeUrl REST call

I was working on SharePoint 2013 REST API to fetch the list of folders from a document library specifically a discussion List. The usual lists/getByTitle endpoint gets the list of folders but without the URL of the folder. When I checked the REST API examples at MSDN , one thing which caught my attention was getFolderByServerRelativeUrl endpoint. Unfortunately the examples provided in the MSDN is not correct. As per the MSDN, we need to pass the document library name as a parameter. executor.executeAsync({   url: " /_api/SP.AppContextSite(@target)/web     /getfolderbyserverrelativeurl( '/Shared Documents' )     ?@target= ' ' ",   method: "GET" ,   headers: { "accept" : "application/json; odata=verbose" },   success: successHandler,   error: errorHandler }); When we try this, we get 400 error (Bad request). So what is the correct way of making it work? You need to pass the relative URL of the document library not just