Sharepoint - Getting document name using REST (not title) while filtering document library

How to retrieve document name using SharePoint REST

Since FileRef contains file name, you could utilize the following query to return document names:

Endpoint: /_api/web/lists/getByTitle('<list title>')/items?$select=FieldValuesAsText/FileRef&$expand=FieldValuesAsText

Example

Get documents (names) that have been created from 2014 year:

/_api/web/lists/getByTitle('Documents')/items?$select=FieldValuesAsText/FileRef&$expand=FieldValuesAsText&$filter=Created ge  datetime'2014-01-01T00:00:00'

FileLeafRef:

 /_api/web/lists/getByTitle('list')/items?$select=FileLeafRef

File Name:

/_api/web/lists/getByTitle('<list title>')/items?$select=File/Name&$expand=File

Also, for querying a document library by Name of document, use below:

/_api/web/lists/getByTitle('Doc Library Name')/items?$select=FileRef&$filter=substringof('Test Document Name',FileRef)";

Tags:

Rest

Filter