How do i Pass a Map of Key Value pairs to a GET REST API,
Here is the call to the resource .. I am getting a method not allowed
String queryMap= String.format("{'softwareversion':'%s','peril':'%s','analysistype':'%s', 'region':'%s'}", "HD18", "Flood", "EP", "USFL");
String url = String.format("http://localhost:%d/templates/modelprofile?queryMap=%s", API_APPLICATION_RULE.getLocalPort(),queryMap);
Response response = ClientBuilder.newClient()
.target(url)
.request()
.header("Authorization", getToken())
.get();
I have the resource as below
@GET
@Path("/{templateType}")
@Timed
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get templates based on peril/region,version and type",
httpMethod = ApiConstants.GET)
@ApiResponses(value = {
@ApiResponse(code = ApiConstants.INT_200,
message = "TemplateReader was retrieved successfully from the database."),
@ApiResponse(code = ApiConstants.INT_400,
message = "Bad request (wrong or missing inputs)"),
@ApiResponse(code = ApiConstants.INT_500,
message = ApiConstants.INTERNAL_SERVER_ERROR)
})
public Template getTemplate(@ApiParam(hidden = true) @Auth User user,
@ApiParam(name = "templateType", value = "templateType")
@PathParam("templateType") String templateType,
@ApiParam(name = "queryMap", value = "queryMap")
@RequestParameters Map<String,String> queryMap
) throws ApiException