0

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?

2 Answers 2

1

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);
Sign up to request clarification or add additional context in comments.

Comments

0

You should separate the path params as follows: @Path("/id/{userId}/{type}/{date}")

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.