Here's my model class:
public class RequestBody {
@JsonProperty("polygon")
private GeoPolygon geoPolygon;
@JsonProperty("domain_id")
private String domainId;
private String availability;
@JsonProperty("start_time")
private String startTime;
@JsonProperty("end_time")
private String endTime;
@JsonProperty("page_size")
private int pageSize;
private int offset;
//getters, setters, toString()
Below is my controller:
@RequestMapping(value = "/request", method = RequestMethod.GET, produces = "application/json")
public ResponseEntity getResponse(RequestBody request){
// process request, return response.
}
This is how I'm calling the API:
http://localhost:9876/request?availability=TEMPORARY&start_time=2017-06-06T13:24:23Z&end_time=2017-06-05T13:24:23Z&polygon={"type":"polygon","coordinates":[[[-120,10],[-30,10],[-30,60],[-120,60],[-120,10]]]}&domain_id=XYZ&page_size=10&offset=1
Now the issue:
All the properties are not getting mapped. Specially the ones with @JsonProperty
annotation. These fields remain null.
I sent the same model to the POST
request at the same endpoint and that worked completely fine. Is @JsonProperty
not supported with GET
?