REST-Based Web Services
REST-based Web services are implemented using HTTP. They offer a light-weight alternative to the original SOAP and WSDL-based Web services.
REST works with resources that are identified with a Uniform Resource Identifier (URI). A resource represents a static or dynamically‑generated Web page. REST resources are named with nouns as part of the URI rather than verbs; for example, /customers rather than /getCustomers.
To use REST services, a client sends an HTTP request using the GET, POST, PUT, or DELETE verb.
The traditional HTTP error messages (for example, 200 ‑ OK and 404 ‑ Not found) can be used to indicate whether a request is successful. If a request is successful, information can be returned in Extensible Markup Language (XML), Microsoft JavaScript Object Notation (JSON), or NewtonSoft JavaScript Object Notation (JSONN) format. REST services exception handling identifies which part of the service is responsible for an unsuccessful request and returns to the client an HTTP error 400 (bad request from the user) or 500 (server error). A 400 error is returned, for example, if the:
-
URL is empty
-
JSON or XML syntax is invalid
-
Called method is not found
-
Called method is protected or it is a type method
-
Data for a method parameter is invalid for its type
-
Data does not match the method signature
-
Type of the object passed does not match the method parameter object type
A server error is returned for other failures such as a logic exception.
Session handling is not performed, so there is no timeout of connections. Additionally, information is not retained between requests from a client. If that is required, it must be provided by the application developer.
For details about the