Android客户端的OKHttp向LeanCloud提交数据不成功,请问哪里有问题?
public boolean putBitmap(String json) {
String url = "https://api.leancloud.cn/3.12.3/classes/image";
MD5Utils utils = new MD5Utils();
long time = System.currentTimeMillis();
String header = utils.getMD5(time + Config.appKey);
MediaType JSON
= MediaType.parse("application/json; charset=utf-8");
RequestBody body = RequestBody.create(JSON, json);
OkHttpClient okHttpClient = new OkHttpClient();
Request request = new Request.Builder()
.addHeader("X-LC-Sign", header +","+time)
.url(url)
.post(body)
.build();
try {
Response response = okHttpClient.newCall(request).execute();
if (response.isSuccessful()) {
return true;
}
} catch (IOException e) {
e.printStackTrace();
return false;
}
return false;
}
请问问题出在哪里?
关于REST部分有可以学习的demo吗?
-
创建时间
16年1月18日
-
最后回复
16年1月19日
-
2
回复
-
595
浏览
-
2
用户
-
2
链接