querying document libraries using SharePoint REST

today I needed to query a document library using the REST api. I found that simply calling _api/web/list/getbytitle(‘foo’)/items would not return me either the filename or full path.

The secret is to call FieldValuesAsText – here FileRef (the server relative path) and FileLeafRef are present. One can either call it directly


or expand it like so


Additionally, to get a nice Icon to display one can call


size can be 0 or 1 – for small or large images respectively.

The Doumentation for this can be found at SP.Web.mapToIcon and SP.ListItem.fieldValuesAsText.