More REST Examples

In this article we can explore more REST and examples.

Get a List by Title

We can get List information using the Title of the list. Make sure you have a list named Contacts.

URL: http://server/_api/Web/Lists/GetByTitle(‘Contacts’)

image

Please note that REST API is provided using the context _api.

Using chrome browser I received the following output.

image

Although IE 11 hesitated to show the output, giving an error message.

image

But in IE too, we can view the output using View Source option.

image

image

By default XML format result is provided by SharePoint REST services. In programmatic way, we can format these results to JSON format.

Getting List Items

We can try getting the list items using REST.

URL: http://sharepoint/_api/Web/Lists/GetByTitle(‘Contacts’)/Items

Using chrome browser I was able to view the following results.

image

However In IE the result summary was shown.

image

image

Please note that REST is trending as a replacement for JSOM in SharePoint world. REST provides much easier, less-coded ways of working with client-side object model.

References

https://msdn.microsoft.com/EN-US/library/office/jj164022.aspx

Summary

In this article we have explored few REST examples using browser URL box.

Leave a Reply

Your email address will not be published. Required fields are marked *