Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android @如何通过改造为webservice带来一些价值_Android_Web Services_Retrofit - Fatal编程技术网

Android @如何通过改造为webservice带来一些价值

Android @如何通过改造为webservice带来一些价值,android,web-services,retrofit,Android,Web Services,Retrofit,我想发送一个带有用户名和密码的整数列表到WebService,比如下面的请求 UpdateDocumentState(List<int> documentIds, string userName, string password) UpdateDocumentState(列出文档ID、字符串用户名、字符串密码) 但我不知道怎么做?使用@Post还是@Put?使用@Query还是@Field?我在谷歌上搜索了一下,但没有找到任何好的例子或教程来很好地解释这些。(我找到的所有教程都是

我想发送一个带有用户名和密码的整数列表到WebService,比如下面的请求

UpdateDocumentState(List<int> documentIds, string userName, string password)
UpdateDocumentState(列出文档ID、字符串用户名、字符串密码)
但我不知道怎么做?使用@Post还是@Put?使用@Query还是@Field?我在谷歌上搜索了一下,但没有找到任何好的例子或教程来很好地解释这些。(我找到的所有教程都是关于@GET的)


有谁能给我一些代码,怎么做吗?

关于@PUT或@POST的使用,我想你必须从WebService开发者那里得到这些信息

无论如何,这里是两种改型注释的示例代码,有或没有回调响应

@POST("your_endpoint")
void postObject(@Body Object object, Callback<Response> callback);

@PUT("/{path}") 
String foo(@Path("path") String thePath);

感谢您的回答,在我的示例中,对象类似于myObject(列表、用户名、密码)?
public class DataToSend {
  public List<Int> myList;
  public String username;
  public String password;
}
@POST
void postList(@Body DataToSend dataToSend, Callback<Response> callback);
yourService.postList(myDataToSend, postCallback);