Route parameters in UniRest

Route Parameters

Sometimes you want to add dynamic parameters in the URL, you can easily do that by adding a placeholder in the URL, and then by setting the route parameters with the routeParam function, like:

Unirest.get("{method}")  .routeParam("method", "get")  .queryString("name", "Mark")  .asJson();

In the example above the final URL will be – Basically the placeholder {method} will be replaced with get.

The placeholder’s format is as easy as: {custom_name}