Skip to content

Instantly share code, notes, and snippets.

@bgoetzmann
Created April 13, 2023 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgoetzmann/4ac447731f07a0e02f7505c1847aee40 to your computer and use it in GitHub Desktop.
Save bgoetzmann/4ac447731f07a0e02f7505c1847aee40 to your computer and use it in GitHub Desktop.
Interface to call SWAPI in restclient application
package odelia.restclient;
import javax.json.JsonObject;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
@RegisterRestClient
@Produces(MediaType.APPLICATION_JSON)
public interface SwapiService {
@GET
@Path("/people/{id}")
JsonObject getCharacter(@PathParam("id") String id);
@GET
@Path("/people")
JsonObject getPeople();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment