0

我使用了链接https://github.com/FredrikL/android-ttTumblr中提到的代码。当我使用此代码时,我无法验证用户名和密码。任何人都可以帮助我请..以下代码用于验证tumblr

HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost(
                "http://www.tumblr.com/api/authenticate");

        try {
            System.out.println("user name : "+Username);
            System.out.println("password : "+Password);
            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
            nameValuePairs.add(new BasicNameValuePair("email", Username));
            nameValuePairs.add(new BasicNameValuePair("password", Password));

            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

            HttpResponse response = httpclient.execute(httppost);
            System.out.println("response value : "+ response.toString());
            System.out.println("response entity : "+response.getStatusLine().toString());
            System.out.println(response.getStatusLine().getStatusCode());
            if (response.getStatusLine().getStatusCode() != 200) {
                return false;
            }
            // Save our list of available blogs.
            SharedPreferences blogs = this.context.getSharedPreferences(BLOGS_PREFS,
                    0);
            Log.d("ttT", "attempting blog list extraction");
            saveBlogList(response, blogs);
            return true;

        } catch (ClientProtocolException e) {
            Log.d(TAG, "client proto exception", e);
        } catch (IOException e) {
            Log.d(TAG, "io exception", e);
        }
        return false;

在这个我得到“response.getStatusLine().getStatusCode() 值为 404”。请任何人帮助我对其进行身份验证。

4

1 回答 1

0

http://www.tumblr.com/api/authenticate does not exist. Therefore you get an HTTP404.

See this

http://www.tumblr.com/docs/en/api/v2

于 2012-09-28T07:43:47.023 回答