[英]Using the Rally Java Rest API, how do I get DirectChildrenCount?
[英]How do I communicate with a REST API using Java/Android?
下午,
我是论坛的新手,所以请放轻松。
我正在寻找在Android应用程序中编写Java包的代码,该应用程序会将GET,POST,UPDATE和DELETE删除到Trading REST API。 使用Java中的HttpClient库,可以使用https://labs.ig.com/gettingstarted 。 我没有在教程领域找到太多东西,Android是否有我可以使用的库?
我感谢任何指示。
提前致谢...
编辑:这可能在Java API中吗?似乎它应该是标准功能,但在Java教程中找不到任何内容。
您可以尝试Spring RestTemplate for android ,对于REST来说已经足够了。
我会考虑其中之一:
改造http://square.github.io/retrofit/
public interface GitHubService {
@GET("/users/{user}/repos")
List<Repo> listRepos(@Path("user") String user);
}
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint("https://api.github.com")
.build();
GitHubService service = restAdapter.create(GitHubService.class);
List<Repo> repos = service.listRepos("octocat");
离子https://github.com/koush/ion
JsonObject json = new JsonObject();
json.addProperty("foo", "bar");
Ion.with(context)
.load("http://example.com/post")
.setJsonObjectBody(json)
.asJsonObject()
.setCallback(new FutureCallback<JsonObject>() {
@Override
public void onCompleted(Exception e, JsonObject result) {
// do stuff with the result or error
}
});
无论您喜欢哪个。 您甚至可以按照https://github.com/octo-online/RoboSpice-samples将Spring-Android或Retrofit与RoboSpice
混合使用, RoboSpice
为您处理后台线程内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.