DHC by Restlet (originally called “Dynamic HTTP Client”) is a tool to interact with REST services. It’s an API testing tool that functions from within a Web browser as a Chrome Web app. It aims to make your user experience better, save you precious time when debugging REST calls, and allow you to share your requests with other people.
DHC is integrated with Restlet’s suite of cloud-based API development, design, and deployment tools.
For situations where testing and QA are concerns, DHC also offers integration with Maven and Jenkins. Plugins allow test scenarios to be included in continuous delivery and continuous integration workflows.
In this tutorial, we will focus on simple installation, and basic functionality like making and displaying requests, leveraging projects and services (saving requests), and importing and exporting requests.
Installing DHC by Restlet
DHC can be used as an online service from https://dhc.restlet.com/ or installed within Chrome from the Chrome Web Store.
The tool is then available in your Chrome applications through chrome://apps.
Making a Request
The main feature of every REST client is to provide a way to build a request and display the response. DHC provides a dedicated area to configure the request. This area maps the different request elements. The latter is summarized in the following figure as a reminder.
Here are some details about these elements:
- The protocol to use to interact with a server.
- Host and port identify the target to contact to send the request. Once connected to the server, the path is used to select the resource to handle the request.
- The method corresponds to the HTTP verb used. It identifies the action to execute on the resource.
- Query parameters are used to build the query string of the request. They contain data that doesn’t fit conveniently into a hierarchical path structure.
- HTTP Headers define the operating parameters of an HTTP transaction. They correspond to a list of key-value pairs.
- Request payload corresponds to the data sent when supported. This applies to methods POST, PUT and PATCH.
DHC defines four distinct sub areas: the request URL and method, the query parameters, the headers and the request payload. The following screenshot describes the case of a GET method where no payload is used.
By default, the query parameter area is hidden and can be displayed by clicking the “?” character right after the address field. You can either directly leverage the URL to add them or use the form. The main difference is, when using the form, parameter values are automatically URL encoded.