REST Web services

REST Web Services

You already know that Web Services are software systems designed to support interoperable machine-to-machine interaction over a network. In this section we are going to talk about another type of Web Services: REST Web services. This kind of services use HTTP for the communication and are based on REST (REpresentational State Transfer) principles as protocol to exchange messages.

Following the specification:

  • The primary purpose of the service is to manipulate representations of Web resources using a uniform set of stateless operations.
  • Do not require XML-based protocols (like SOAP and WSDL) to support their light-weight interfaces.
  • Define a set of operations using HTTP verbs (GET, PUT, POST, or DELETE).
  • The format of the information returned (representation) is typically HTML, XML or JSON, although it may be an image, plain text, or any other content.

Denodo can publish any base/derived views/interfaces as REST Web Services to enable external applications (or users using their browser) to retrieve data from the Data Virtualization layer.

Creating REST Web Services in Denodo

In this example, we are going to create the same service created in the previous section but as REST service.

Let's create your first REST Service in Denodo. These are the steps:

  1. Create a new folder called 'REST'.
  2. Right-click on this new folder and select "New > Data service > REST Web service".
  3. The Tool will open the “Create REST Web Service” dialog. This dialog has similar tabs to the "Create SOAP Web Service" dialog:
    • Resources: here you can define the REST service.
    • Settings: manages the configuration, representation formats and authentication.
    • Advanced: in this tab you can change the parameters of the connection between the Web Service and Denodo server.

New operation

In the first tab (Resources) you can add views to the Web Service. You only have to drag any view/stored procedure/interface to this dialog.

Now, you have to follow these steps:

  1. First, drag the 'i_client_info' interface into the workspace panel.
  2. Rename the REST Service: for example, change the name to customer (right-click the web service name in the top and select Rename).
  3. As you are going to search clients using only the 'ID', you have to remove the rest of fields from the input (right-click the field and select Remove from input).

More settings

REST web services have more configurations available in the second tab (Settings).

In this tab you can complete the REST Web Service definition selecting the output representation format. By default, HTML, XML and JSON are activated.

HTML is the default representation.

NOTE

Another important configuration is the authentication method. By default, created REST services doesn't have any authentication method so any person could use it. In this example, simply select HTTP Basic with VDP method (leaving empty the Accepted user(s) field) to delegate the authentication to the Denodo server.

Finally, click on "Ok" button to create the REST Web Service.

There are more configurations available (as you can see in the previous screenshot), you can find the complete information about the REST services in the DataPort Administration Guide document.

TIP

Now, you have created a SOAP and a REST web service in Denodo, in the next section you are going to see how to deploy them in the Denodo internal web container.