Recently i attended an interview for one of the company, the interviewer asked me a question on rest api. How to get a publishing image field using rest api? I answered its the normal way how we get the other fields. But later i came to know that its the wrong answer. After some research on Google came to know that there some limitations to rest api in sharepoint 2013. Below is a list of columns available using Rest api.
As far as getting the publishing image field we need to make two requests. First get the item using the below query
| Column | Support | Notes |
|---|---|---|
| Hyperlink or Picture | Supported | |
| Single Line of Text | Supported | |
| Multiple lines of text :: Plaintext | Supported | |
| Multiple lines of text :: Richtext | Supported | Returns unencoded XHTML |
| Multiple lines of text :: Enhanced Richtext | Supported | Returns unencoded XHTML |
| Choice | Supported | Column is required in the $expand keyword |
| Counter | Supported | |
| Integer | Supported | |
| Number | Supported | |
| Currency | Supported | |
| Date | Supported | Returns an ISO 8601 date e.g. 2013-03-08T11:00:00 |
| Yes/No | Supported | Returns true or false string literals |
| Person or Group | Supported | Column is required in the $expand keyword, append “Id” to the column name to get the user id (UserInformationList) value inline with each entry |
| Person or Group (Multi) | Supported | Column is required in the $expand keyword |
| Calculated | Supported | |
| Computed | Supported | |
| Managed Metadata | Not Supported | |
| Managed Metadata (Multi) | Not Supported | |
| Publishing HTML | Not Supported | |
| Publishing Hyperlink | Not Supported | |
| Publishing Image | Not Supported | |
| Media Field | Not Supported | |
| Summary Links | Not Supported | |
| Publishing Image | Not Supported | |
| Lookup | Supported | Column is required in the $expand keyword, append “Id” to the column name to get the lookup column target id value inline with each entry |
| Lookup (Multi) | Supported | Column is required in the $expand keyword |
Request1 url: http://wingtip.com/_api/web/lists/getbytitle('contacts')/items
In the second request we need to add fieldvalueashtml to url.
Request2 url: http://wingtip.com/_api/web/lists/getbytitle('contacts')/items(1)/fieldvalueashtml
Reference: http://stackoverflow.com/questions/25852997/retrieve-publishing-image-field-with-sharepoint-2013-rest-api-csom
http://www.ashokraja.me/post/Querying-and-exploring-REST-API-with-oData-in-SharePoint-2013-with-DataBase-net.aspx
http://www.ashokraja.me/post/Querying-and-exploring-REST-API-with-oData-in-SharePoint-2013-with-DataBase-net.aspx
Hope its helpful.
Excellent beat ! I wish to apprentice at the same time as you amend your web site, how can i subscribe for a blog website? The account aided me a appropriate deal. I had been tiny bit familiar of this your broadcast provided vibrant clear concept
ReplyDelete