REST Enabled Web Services in SharePoint

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.)

rest

Example

The following are a few examples of REST.

examples of REST

Advantages

The following are the advantages of going with REST:

  1. REST web requests are easier to work with.

  2. No overheads of WSDL creation.

  3. No overheads of tying up with Service Reference.

  4. Direct Calls for fetch, insert, update, delete and find operations.

  5. 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:

  1. POST for Create
  2. GET for Read
  3. PUT for Update
  4. DELETE for Delete

Operations

The following are the subset of operations we can do using SharePoint and REST:

  1. Create a Site Collection
  2. Create a List
  3. Create a Content Type
  4. Add, Edit, Delete items from a List
  5. 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:

    XHTTPMethod = "X-HTTP-Method: "
    ("PUT"
    / "MERGE"
    / "PATCH"
    / "DELETE")
    CRLF

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.