Reputation: 1751
I have a dropwizard application to POST/GET query information. I have a @POST
method that populates an arrayList with my query and its' 11 parameters. For brevity, I cut the example down to only show 3 parameters.
@Path("/query")
public class QueryResource
@GET
@Produces(MediaType.APPLICATION_JSON)
@Timed
public List<Query> getQueries() {
List<Query> queries = new ArrayList<Query>();
logger.info("Calling get queries with {} method.");
queries.add(new Query("b622d2c6-03b2-4488-9d5d-46814606e550", "eventTypeThing", "action"));
return queries;
I can send a get request through ARC and it will return successful with a json representation of the query.
I run into issues when I try to make a @GET
request on the specific queryId
and return a specific parameter of it. As such,
@GET
@Path("/{queryId}/action")
public Response getAction(@PathParam("queryId") String queryId, @PathParam("action") String action){
logger.info("Get action by queryId {}");
String output = "Get action: " + action;
return Response.status(200).entity(output).build();
On the rest client I make a get request to https://localhost/query/b622d2c6-03b2-4488-9d5d-46814606e550/action
I'm expecting that to return the action type of that specific queryId
, but instead is returning null.
Upvotes: 0
Views: 505
Reputation: 724
You did not declare "action" as a proper param in the @Path annotation of the method. You need to change that to:
@Path("/{queryId}/{action}")
Upvotes: 1