What programming components are needed for developing REST a
What programming components are needed for developing REST applications? Explain.
Solution
REST Web service follows four basic design principles:
a) Use HTTP methods explicitly.
b) Be stateless.
c) Expose directory structure-like URIs.
d) Transfer XML, JavaScript Object Notation (JSON), or both.
Use http methods explicitly :
REST asks developers to use HTTP methods explicitly and in a way that\'s consistent with the protocol definition. This basic REST design principle establishes a one-to-one mapping between create, read, update, and delete (CRUD) operations and HTTP methods.
Be stateless :
A complete, independent request doesn\'t require the server, while processing the request, to retrieve any kind of application context or state. A REST Web service application includes within the HTTP headers and body of a request all of the parameters, context, and data needed by the server-side component to generate a response. Statelessness in this sense improves Web service performance and simplifies the design and implementation of server-side components because the absence of state on the server removes the need to synchronize session data with an external application.
Expose directory structure-like URIs :
REST Web service URIs should be clear to the point where they are easy to guess. Consider URI as a kind of self-documenting interface that requires little, if any, explanation or reference for a developer to understand what it points to and to derive related resources.
Transfer XML, JSON or both :
A resource representation typically reflects the current state of a resource, and its attributes, at the time a client application requests it. Resource representations in this sense are snapshots in time. This could be a thing as simple as a representation of a record in a database that consists of a mapping between column names and XML tags, where the element values in the XML contain the row values.
