I was trying to get data from rest api using Retrofit
. The api is a get
request and the query params should be of the form
{state: 'state', filters: {page: 1, filter: ''}}
I tried creating a Filter class and annoted the same inside Request body class like below
public class ReferralRequestBody {
@SerializedName("filters")
@Expose
private Filter filter;
public Filter getFilter() {
return filter;
}
public void setFilter(Filter filter) {
this.filter = filter;
}
}
This is how I am trying now to send the request. It is a get request with query params. I need to send the Filter as query param.
@GET("/api/data")
Observable<APIResponse> getData(@Query("state") String state,
@Query("filters") RequestBody filter);
But the request is still bad. Please help.