SharePoint 2013 supports REST enabled web services.
REST
REST is Representational State Transfer. REST is an architectural style and uses the HTTP protocol.
REST provides more interoperability than SOAP (web services).
REST is supposed to be the right way of using HTTP verbs for Create, Read, Update and Delete (CRUD) operations as in protocol definition in RFC 2616. (POST for Create, GET for Read, PUT for Update and DELETE for Delete.)
Example
The following are a few examples of REST.
Advantages
The following are the advantages of going with REST:
- REST web requests are easier to work with.
- No overheads of WSDL creation.
- No overheads of tying up with Service Reference.
- Direct Calls for fetch, insert, update, delete and find operations.
- Better Interoperability supporting various clients on multiple platforms, programming models.
SharePoint and REST
SharePoint 2013 supports REST. This feature requires some inner tweaking of the existing web services.
In SharePoint the usage of HTTP Verbs as in REST is given below:
- POST for Create
- GET for Read
- PUT for Update
- DELETE for Delete
Operations
The following are the subset of operations we can do using SharePoint and REST:
- Create a Site Collection
- Create a List
- Create a Content Type
- Add, Edit, Delete items from a List
- Get an Item
X-HTTP-Method
Sometimes network firewalls block certain HTTP Verbs like PUT and DELETE. In this case we need to rely on the X-HTTP-Method that is actually a header.
The syntax is:
The REST services of SharePoint are comparable with Client-Side Object Models. We can use REST services as an alternative to CSOM or JSOM code.
References
Get started with the SharePoint 2013 REST service.
Summary
In this article we explored SharePoint and REST.