Presently I am using the following method to get the server relative URL
function getLibraryUrl(nameOrUrl)
{
var ctx = SP.ClientContext.get_current();
var list = ctx.get_web().get_lists().getByTitle(nameOrUrl);
ctx.load(list,'RootFolder');
ctx.executeQueryAsync(
function(){
var url=list.get_rootFolder().get_serverRelativeUrl();
return url;
},
function(sender, args)
{
});
}
But, I don't want to use the asynchronous call. Can any one please guide me to get the server relative URL of document library using rest API.
Something like this /_api/Web/Lists/getByTitle('')/items?$select=File/ServerRelativeUrl&$expand=File