【发布时间】:2017-03-30 09:19:47
【问题描述】:
我是新手,知道这个问题有很多帖子,但我找不到我的答案。
因此,我需要使用 retrofit2 和请求“PATCH”来升级用户及其议程。但是,我不知道如何使用 Retrofit2。
即使我的研究...没有任何工作!
你能帮帮我吗?
感谢提前 :D
这是我必须发送的:
{
"gender": "M",
"trainerName": "Patrick",
"laterality": "L",
"email": "xxxx@gmail.com",
"phoneNumber": "XXXXX",
"agendaWeekDays": [
{
"position": 1,
"startSeconds": 648000,
"endSeconds": 72000
},
{
"position": 2,
"startSeconds": 0,
"endSeconds": 459
}
]
}
响应是 Just :
{
"success"
}
我的请求
public interface Minterface {
@FormUrlEncoded
@PATCH("api/members/current")
Call<String> test(
@Field("access_token") String access_token,
@Field("agendaWeekDays") ArrayList<Agenda> agendaWeekDays);
}
Agenda.class:
public class Agenda
{
@SerializedName("position")
@Expose
private Integer position;
@SerializedName("startSeconds")
@Expose
private Integer startSeconds;
@SerializedName("endSeconds")
@Expose
private Integer endSeconds;
public Integer getPosition() {
return position;
}
public void setPosition(Integer position) {
this.position = position;
}
public Integer getStartSeconds() {
return startSeconds;
}
public void setStartSeconds(Integer startSeconds) {
this.startSeconds = startSeconds;
}
public Integer getEndSeconds() {
return endSeconds;
}
public void setEndSeconds(Integer endSeconds) {
this.endSeconds = endSeconds;
}
}
【问题讨论】: