*P.s: Changed references for security matters.
I'm trying to get json from a server but it requires form-data in the body of request, like this:

It works when tested in postman, but I just can't figure out how to do this using retrofit2.
Beans:
public class Y {
@SerializedName("id")
private int yId;
@SerializedName("name")
private String yName;
//...
}
public class YList {
@SerializedName("ys")
private List<Y> ys;
//...
}
The service interface is like this:
public interface YService {
@POST("y")
Call<YList> getY()
public static final YService serviceY = new Retrofit.Builder()
.baseUrl("http://example.com.br/api/x/")
.addConverterFactory(GsonConverterFactory.create())
.build()
.create(YService.class);
}
And REST method:
YService yService = YService.serviceY;
yService.getY().enqueue(new Callback<YList>() {
@Override
public void onResponse(Call<YList> call, Response<YList> response) {
if (response.isSuccessful()) {
//...
} else {
//...
}
}
@Override
public void onFailure(Call<YList> call, Throwable t) {
//...
}
});'
Postman JSON result:
{
"auth": {
"validation": true
},
"ys": [
{
"id": 1,
"name": "#"
}
]
}