[REST] What is REST?

What is REST?

What is REST? REST stands for Representational State Transfer. RESTIt is a stateless, client-server communication protocol that relies on HTTP protocol. REST was designed to be able to communicate within servers without much complication using the HTTP protocol. The difference with REST protocol is that there is no specific “standard” to be used. REST can be used to create, update, delete and read data from a service which supports REST. Despite being simple, REST is fully-featured; there’s basically nothing you can do in Web Services that can’t be done with a RESTful architecture.

A RESTful service can be broken into main 4 requests.

GET read data from a service
POST create data in a service
PUT update data in a service
DELETE delete data from a service

As discussed earlier REST is a simple, Lightweight, “standard”less protocol. To see how REST is different from another protocol that is used to communicate within servers SOAP protocol can be used.

REST is simple

How is REST simple? when comparing requests sent through REST and SOAP we can clearly see how simple REST actually is.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
       xmlns:ser="http://services.samples">
       <soapenv:Header/>
       <soapenv:Body>
              <ser:getSimpleQuote>
                     <ser:symbol>nu1silva</ser:symbol>
              </ser:getSimpleQuote>
       </soapenv:Body>
</soapenv:Envelope>

So, REST request will look like;

GET http://nu1silva.com/rest/simplequote/symbol/nu1silva

Its simple as that.

REST is Lightweight

Writing and Testing a REST service can be easily done. As pointed earlier, when compared to testing a service that accepts REST vs SOAP specialized software is not required and you can test it by sending CURL requests or a simple browser client such as Advanced REST Client or Postman.

REST is “Standard”less

REST is standardless. It can be implemented in anyway the anyone wants. When taking to account a simple User Management Application that uses REST to do CRUD (Create, Read, Update and Delete) operations the application can be written to accept input in many different ways. As an example the requirement is to show details of a user with the user ID 1234. The request can be any of the following.

GET http://nu1silva.com/usermanagement/user/1234

GET http://nu1silva.com/usermanagement/user=1234

GET http://nu1silva.com/usermanagement/user/search/1234

GET http://nu1silva.com/usermanagement/user/search/id=1234

Simple REST sample

Explaining REST can be done through a simple user management solution with CRUD operations. as shown above you can use CURL command or any client you require.

Create a user

GET http://nu1silva.com/usermanagement/user/create

Read a users details

GET http://nu1silva.com/usermanagement/user/search/001

Update a user

GET http://nu1silva.com/usermanagement/user/update

Delete a user

GET http://nu1silva.com/usermanagement/user/delete/001

These are sample request that can be used when using REST protocol. As shown above REST is a simple, lightweight, standardless protocol that is heavily used in the modern internet era.

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.