I am using RetroFit for the first time, so it is confusing me. I am trying to pass a JSON object to the server via POST. However I don't know how can make the model classes and the methods for the retrofit library. My JSON looks like this:
{
"Header": {
"UserDetails": "sample string 1",
"ClientCode": "sample string 2",
"Password": "sample string 3",
"ViewType": 0,
},
"MemberDetails": {
"Username": "sample string 1",
"Password": "sample string 2",
"MemberNo": "sample string 3",
"MobileNo": "sample string 4"
}
}
I have generate 2 model classes: Header and MemberDetails
The Interface class is like this:
public interface MyServerAPI {
@POST("users/memberlogin")
Call<> login(@Body WHAT_OBJECT_TO_PASS_HERE?);
}
I don't know whether to pass both Header and MemberDetails object or put them in a ArrayList and pass that to the login().