We're using the Sharepoint 2013 REST API to get all news items from the Sharepoint.
We made a custom ContentType 'Newsitem' with several properties including a Publishing Image Field.
var contentTypeId = "0x01100018B03AC7E8312648AEA00851DEDBCAF802";
var standardUri = "https://examplesite.com/blog/_api/lists/getbytitle('Messages')/items?$top=7&$filter=startswith(ContentTypeId,'" + contentTypeId + "')";
var selectiveUri = "https://examplesite.com/blog/_api/lists/getbytitle('Messages')/items?$top=7&$filter=startswith(ContentTypeId,'" + contentTypeId + "')&$Select=Title,Teaser,Body,ShowAt,TeaserImg";
Using standardUri for my REST call, I retrieve all properties but no TeaserImg.
Explicitly selecting TeaserImg makes the call fail of course.
Why can't I find the TeaserImg, isn't this possible with Sharepoint 2013 REST Api and should I use CSOM instead?
Best Answer
It does not seem possible to retrieve
Publishing Image
fields using List Item Collection endpoint.There is a workaround, publishing fields could be retrieved using
ListItem.FieldValuesAsHtml
property via SharePoint REST endpoint as demonstrated belowHow to retrieve Publishing fields using SharePoint 2013 REST
Usage
The following example demonstrates how to retrieve page fields including publishing fields, such as
PublishingRollupImage
:Probably the best solution here would be to utilize CSOM