使用loopj AysyncHttpClient android库发布请求

时间:2014-05-26 21:40:43

标签: android rest google-cloud-endpoints http-request androidhttpclient

尝试通过REST发布到Google云端点时,我收到org.apache.http.client.HttpResponseException:错误请求

在我的Android应用上尝试使用http://loopj.com/android-async-http/时。我在POSTMAN REST客户端发了这篇文章没有错误。

以下是代码

AsyncHttpClient client = new AsyncHttpClient();
RequestParams p = new RequestParams();
p.put("test", "123");
client.addHeader("Content-Type", "application/json");
client.post("https://flash-energy-585.appspot.com/_ah/api/reminders/v1/reminders/createreminder",p, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(String response) {
            // Successfully got a response
            System.out.println(response);
        }

        @Override
        public void onFailure(Throwable error) {
            System.out.println(error.toString());
        }
    });

0 个答案:

没有答案