Skip to content

Commit

Permalink
Query Param addition to the docs
Browse files Browse the repository at this point in the history
Co-authored-by: Guillaume Smet <[email protected]>
  • Loading branch information
oztimpower and gsmet committed Mar 3, 2021
1 parent 23e85b9 commit 6968a52
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/src/main/asciidoc/rest-client.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,34 @@ If you don't rely on the JSON default, it is heavily recommended to annotate you
It will allow to narrow down the number of JAX-RS providers (which can be seen as converters) included in the native executable.
====

=== Query Parameters

If the GET request requires query parameters you can leverage the `@QueryParam("parameter-name")` annotation instead of (or in addition to) the `@PathParam`. Path and query parameters can be combined, as required, as illustrated in a mock example below.

[source, java]
----
package org.acme.rest.client;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
import org.jboss.resteasy.annotations.jaxrs.PathParam;
import org.jboss.resteasy.annotations.jaxrs.QueryParam;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import java.util.Set;
@Path("/v2")
@RegisterRestClient
public interface CountriesService {
@GET
@Path("/name/{region}")
Set<Country> getByRegion(@PathParam String region, @QueryParam("city") String city);
}
----


== Create the configuration

In order to determine the base URL to which REST calls will be made, the REST Client uses configuration from `application.properties`.
Expand Down

0 comments on commit 6968a52

Please sign in to comment.