Reputation: 149
Is this the right way to have multiple parameters for a REST API ?
@GET
@Path("/id/{userId,type,date}")
@Nullable
@Produces(MediaType.APPLICATION_JSON)
List<Exercise> findExercises(
@ApiParam( value = "User ID", required=true) @PathParam("userId") Long userId,
@ApiParam( value = "Type") @PathParam("type") String type,
@ApiParam( value = "Date") @PathParam("date") String date);
If not, how can i accomplish that?
Upvotes: 0
Views: 2481
Reputation: 977
I guess this is the right way :
@GET
@Path("/id/{userId}/{type}/{date}")
@Nullable
@Produces(MediaType.APPLICATION_JSON)
List<Exercise> findExercises(
@PathParam("userId") Long userId,
@PathParam("type") String type,
@PathParam("date") String date);
Upvotes: 1
Reputation: 823
You should separate the path params as follows: @Path("/id/{userId}/{type}/{date}")
Upvotes: 0