Get Document Path (ServerRelativeUrl) in SharePoint 2013 using REST API

Suppose we have a document in document library in SharePoint 2013 inside sub folders

Ex: /En/Documents/Folder1/Folder2/stats.png

Now, using REST API we need to get the Server Relative Url (ServerRelativeUrl) by the document ID.

Solution

The REST API url will be: http://<server name>/<sub site>/_api/web/lists/getbytitle(‘Documents’)/items(‘<Document ID>’)/File

In my case it will be : http:// <server name>/En/_api/web/lists/getbytitle(‘Documents’)/items(‘5‘)/File

Result

Advertisements