Sharepoint Rest: Get library url

Iron Contributor


How do I get the library URL? 

I tried with ServerRestUrl but I am getting undefined :\ 


Best regards


4 Replies

I managed solve the url thing by creating it manually like this:


hostweburl + '/' + this.Title


But I noted another problem:

In the site I have created 2 libraries "test" and "test2" but in the result, besides this 2 libraries, I am also getting system libraries like "MicroFeed", "appfiles", "appdata", etc. 


I there a way to filter this system folder out? 


This is how I am sending my request:

url: appweburl + "/_api/SP.AppContextSite(@target)/web/lists?@target='" + hostweburl + "'"

and later I am using this:

$(results).each(function () {
items.push('<li class="element">'
+ '<a target="_parent" href="' + hostweburl + '/' + this.Title + '">' + this.Title + '</a>'
+ '</li>');

Any tips??



The example above returns information about your file such as the name, full url and the internal “Title”:


For instances where you want to know the “type” of document library it is (example Picture Library vs Document Library), use:

Although some information regarding document libraries require an entirely new endpoint. This includes file paths, subfolders, thumbnails and such.

The above contains an entire new set of information regarding your library.




There is a little difference with the proposal you posted. I need to get the list of all libraries that is why I am using: 

url: appweburl + "/_api/SP.AppContextSite(@target)/web/lists?@target='" + hostweburl + "'"

without pointing to a specific library.

The result I am getting doesn't contains "EncodedAbsUrl" in the respons.

This is the response for one of the libraries:




Best regards






If you are using SharePoint Online, you can try the below code for retrieving the Library URL,


        url: hostweburl + "/_api/web/AppTiles?$filter=BaseTemplate eq 101",
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function (response) {
            var libItems = "";
                libItems +="<li><a href='"+this.Target+"'>"+this.Title+"</a></li>";
        error: function (data) {

SharePoint Online returns the collection of lists, libraries and subsites under the below rest endpoint,




Shantha Kumar T