在Retrofit2中使用@put更新时遇到问题。 我发表了一篇文章并更改了对象,现在我想将该更新的对象发送到Web服务。 我遇到@put问题时,我不了解它的运行方式,或者我不知道自己在做错什么...
我在其中定义了Post和Put的PostService接口是这样的:
public interface PostService {
String API_ROUTE = " obtenerListaAlarmasSMS";
@GET(API_ROUTE)
// Call< List<Post> > getPost(@Header("Authorization") String credencialesEnBase64);
Call<Post> getPost(@Header("Authorization") String credencialesEnBase64);
@PUT(" obtenerListaAlarmasSMS/{result}")
@FormUrlEncoded
Call<Post> updatePost(@Path("result") List<List<List<List<Object>>>> result);
}
在我收到JsonArray的Post类中,它是这样的:
public class Post {
@SerializedName("result")
@Expose
private List<List<List<Object>>> result = null;
public List<List<List<Object>>> getResult() {
return result;
}
public void setResult(List<List<List<Object>>> result) {
this.result = result;
}
}
如您所见,我从Web服务带来的对象是列表中的一个列表...。
事实是,一旦我收到列表并在Mainactivity中使用它进行一系列操作,我想放看跌期权来更新它,但是我不知道如何...
我尝试了几种方法,在PostService类中添加了Put,但是我认为我做错了。