REST-basicsRepresentational State Transfer (REST) technology has made its way to the top of the list when it comes to website and application design. Known for its peak performance, scalability and portability, REST is the preferred choice amongst developers and serves as a viable alternative to SOAP, the standard used for the past decade.

What is REST? It is an architectural model developed by W3C’s Technical Architectural Group (TAG) that uses a particular set of design principles or guidelines for the development of web services that communicate through Hypertext Transfer Protocol (HTTP). Used by almost everything that connects to a network (e.g., smartphones, wearables, televisions, intranets and web servers), HTTP is the base protocol on which the Internet was built. A web service that adheres to REST constraints is said to be a “RESTful” service.

A number of experts find that REST provides a lightweight alternative than its SOAP counterpart. REST can use four different HTTP 1.1 verbs (GET, POST, PUT, and DELETE) to perform tasks. In addition, RESTful web services return data in two ways—in XML and/or JSON format. Newer REST implementations use JSON as the preferred method, and experts agree that REST-JSON is the only way to go with mobile-app-based services, due to its fast and effective deployment methods.

In a recent Dr. Dobbs article, M. Vaggas provides a RESTful Web Services tutorial, highlighted here:

A RESTful design promises that your website will be this service to be easy to implement, maintainable, extensible, and scalable. In general, RESTful services should have following properties and features:

  • Since a major part of RESTful service design depends on providing access to resources, identifying resources determining how they relate to each other is the first step when creating a service.
  • Once resources are identified, choose the format (JSON and/or XML) to represent the resources. If you are building Web services that will be used by Web pages for AJAX calls, then JSON is a good choice. XML can be used to represent more complex resources. You can use more than one format and decide which one to use for a response depending on the type of client or some request parameters.
  • The client and service talk to each other via messages. Clients send a request to the server, and the server replies with a response. It is important to have some background about the HTTP 1.1 request and response formats for designing RESTful Web services.
  • REST requires each resource to have at least one URI. A RESTful service uses a directory hierarchy like human readable URIs to address its resources. The job of a URI is to identify a resource or a collection of resources. The actual operation is determined by an HTTP verb.

For full tutorial details, complete with examples, see the article on the Dr. Dobbs website.

==========

APPLICATION DEVELOPMENT: Blue Mountain Data Systems is dedicated to Application Development and Systems Integration for Federal Civilian Agencies, Document Management Systems that help in the preparation, scanning, indexing, categorizing and quality control of millions of pages of paper documents to electronic format and the Automation of Workflow Processes. Call us at 703-502-3416.

==========

 

RESTful Web Services: The Basics

Leave a Reply