I want to post
data as follows:
{
"user_id":"14545646",
"list":["4545645","4545645","4545645","4545645"]
}
I used the following Retrofit
method:
interface DeleteOrder {
@FormUrlEncoded
@POST("/api/shop/deleteOrder.json")
void getPoJoDeleteOrder(@Field("user_id") String user_id, @Field("list") String[] list,Callback<PoJoDeleteOrder> callback);
}
Is this the correct way?
if have many user,then use FieldMap
.
user[0][email]=&user[0][password]=&user[1][email]=&user[1][password]=
@POST("/user/sign_in")
User login(@FieldMap Map<String,String> fields)
;
Map<String,String> fields = new HashMap<>();
for (int i=0;i<users.size();i++) {
User user= users.get(i);
fields.put("user["+i+"][email]",user.email);
fields.put("user["+i+"][password]",user.password);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With