Define the data to be requested as an entity class
public class CustomBody {
public String token;
public User user;
public Order order;
public CustomBody(String token, User user, Order order) {
this.token = token;
this.user = user;
this.order = order;
}
public static class Order {
public String id;
public Order(String id) {
this.id = id;
}
}
public static class User {
public String id;
public String name;
public User(String id, String name) {
this.id = id;
this.name = name;
}
}
}
Retrofit’s Service can be written like this, using @Body annotations
public interface MyService {
@POST("/")
Observable<T> access(@Body CustomBody customBody);
}
Use HttpLoggingInterceptor to view the details of HTTP requests in the log.
Define the data to be requested as an entity class
Retrofit’s Service can be written like this, using
@Body
annotationsUse
HttpLoggingInterceptor
to view the details of HTTP requests in the log.