So I need to send an API request in this format
{ "access_key": "6477848488cchfc47488", "person": { "first_name": "John", "last_name": "Henry", "email": "john@henry.com" } }
I have created an object
public class Person {
public String first_name = "";
public String last_name = "";
public String email = "";
}
In my interface I have
@FormUrlEncoded
@POST("/send_details")
void sendDetails(@Field("person") Person person, @Field("access_key") String accessKey, Callback<User> cb);
Finally in my Activity I have the code below to call the send details method
Person person = new Person("John", ":"Henry, "john@henry.com");
aApi.sendDetails(person, ACCESS_KEY, new Callback<User>() {
@Override
public void success(User user, Response response) {
}
@Override
public void failure(RetrofitError error) {
}
});
}
I get a 500 Internal Server Error. I've just switched from volley to retrofit. Would appreciate any help.