Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

rest
restful
web services

RESTful web services

Educative Answers Team

RESTful web services are web services based on the REST, or REpresentational State Transfer, architecture. REST architecture is a web standard that specifies a set of constraints. REST treats every component (data and functionality) as a resource that can be accessed using standard methods. Due to this standardization, RESTful web services provide interoperability across computer systems on the Internet as well as other desirable properties like performance, scalability, and modifiability.

RESTful web services use HTTPHTTP methods are used to access resources.. Some common methods are GET, POST, PUT, and DELETE.

Principles

RESTful applications follow these principles:

  • Resource identification through the Uniform Resource Identifier (URI)a string of characters that unambiguously identifies a particular resource.:
    Every resource or object has its own specific URI for global addressing and service discovery.
  • Uniform interface:
    Resources should only be manipulated using the HTTP methods: GET, POST, PUT, and DELETE.
  • Self-descriptive messages:
    Resources are decoupled from their representation and their content can have a variety of formats.
  • Stateful interactions through hyperlinks:
    All interactions with a resource are stateless. Instead, each request must contain all of the information necessary to understand the request.

Example

Let’s consider an example of a web service that provides weather information using the REST architectural style.

svg viewer
Interacting with a web service

The web service server provides a REST interface and a weather resource that has the URI, /service/weather.

The client makes an HTTP POST request in JSON format to get the weather for the city of Paris. The server responds with an HTTP POST response JSON object that has the weather information.

RELATED TAGS

rest
restful
web services
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring