Skip to content

Commit

Permalink
Merge pull request #15428 from oztimpower/tp/docs-rest-client
Browse files Browse the repository at this point in the history
Query Param addition MP Rest Client docs
  • Loading branch information
gsmet authored Mar 3, 2021
2 parents 590d643 + 3f3c8ae commit 172446c
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 172446c

Please sign in to comment.