I have an API where it accepts 4 Queryparams
. Here the problem is, it is accepting only first QueryParam
and not accepting other QueryParams
Sample Curl
:
1) curl -vk -X GET http://localhost:8080/sample-application/employee?empname=sat&empId=3438&designation=developer
Here its not accepting empId
& designation
i.e in the O/P
printing null
values
2) curl -vk -X GET http://localhost:8080/sample-application/employee?empId=3438&empname=sat&designation=developer
Here its not accepting empname
& designation
i.e in the O/P
printing null
values
3) curl -vk -X GET http://localhost:8080/sample-application/employee?designation=developer&empname=sat&empId=3438
Here its not accepting empname
& empId
i.e in the O/P
printing null
values
Here is my code
@Path("/employee")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class EmployeeRS {
private static final Logger logger = LoggerFactory.getLogger(EmployeeRS.class);
@GET
@ApiOperation(value = "Get Employee Details", response = Employee.class)
public Response getEmployee(
@ApiParam(value = "Employee Name", required = false) @QueryParam(value = "empname") final String empname,
@ApiParam(value = "Employee Id", required = false) @QueryParam("empId") String empId,
@ApiParam(value = "Designation", required = false) @QueryParam("designation") String designation) {
logger.info("Get Employee for empname:{}, empId:{}, designation:{}",
empname, empId, designation);
//Functionality to get Data
}
}