Introduction
Representational state transfer (REST) or RESTful web services are a way of providing interoperability between computer systems on the Internet. REST-compliant web services allow requesting systems to access and manipulate textual representations of web resources using a uniform and predefined set of stateless operations. Other forms of web services exist which expose their own arbitrary sets of operations such as WSDL and SOAP.
"Web resources" were first defined on the World Wide Web as documents or files identified by their URLs, but today they have a much more generic and abstract definition encompassing every thing or entity that can be identified, named, addressed, or handled, in any way whatsoever, on the web. In a RESTful web service, requests made to a resource's URL will elicit a response that may be in XML, HTML, JSON, or some other defined format. The response may confirm that some alteration has been made to the stored resource, and it may provide hypertext links to other related resources or collections of resources. Using HTTP, as is most common, the kind of operations available include those predefined by the CRUD HTTP methods GET, POST, PUT, DELETE, and so on.
By using a stateless protocol and standard operations, REST systems aim for fast performance, reliability, and the ability to grow, by re-using components that can be managed and updated without affecting the system as a whole, even while it is running.
Architectural Constraints are:
Client-server architecture
Statelessness
Cacheability
Layered system
Uniform interface
Resource identification in requests
Resource manipulation through representations
Self-descriptive messages

The figure illustrates, how the RESTFUL adapter works.
How the RESTFUL Adapter Works
A client sends a message about the HTTP application protocol to a REST API interface.
The presentation format can be JSON, XML, RSS/ATMO feed or any other format.
The API layer that implements the HTTP application protocol has distributed the request to the application layer that resolves the URL to a specific resource.
The resource is delivered by the data layer with the concrete data.

One of the requirements for a REST interface was a universal interface for all clients. This is achieved by using HTTP methods or verbs. The functionality of the app implementation is determined by these verbs. For example, an update is determined with PUT or POST.
REST Adapter – Overview

The figure illustrates an overview about REST adapters.
The following are further details about the directions:
- From REST to XI and Back
What the REST Adapter mainly does is to allow mapping information between HTTP calls and XI messages.
For HTTP calls, the adapter can access information from the URL and the URL parameters, from the HTTP operation (GET, POST, PUT, DELETE), from the HTTP Header (for example, cookie or encoding information) and the payload itself. On XI Messages the adapter can access information from the XI message header and payload.
- From HTTP Call to XI Message
When converting a HTTP call into a XI Message, selected information, except the payload, are taken from the HTTP call and written into XI Header variables.
For convenience, the REST adapter defines a predefined set of XI Header variables like (URL, service, resource, ID, operation, and so on) that can be filled with information from a HTTP call for later use in the Integration Flow or diagnostic purposes.
The payload can be taken as it is, converted into UTF-8 code page and can be converted from JSON into XML and the other way around.
For XI Messages that expect XML and are bound to an interface or operation, the adapter can enclose the payload XML with a given or calculated interface or operation name, based on the incoming HTTP call information.
- From XI Message to HTTP Call
On receiver side, the REST Adapter generates dynamically an HTTP URL from information provided in the configuration and from XI Header and XI Payload. Based on given rules, the interface or operation name can be used to determine the HTTP operation to use (POST, PUT, GET and DELETE). The payload can be converted to format (XML, JSON) and a code page that the REST service is expecting.
Let’s have a look what is happening behind the scenes.