2012-09-28 8 views
0

코드 https://github.com/FredrikL/android-ttTumblr에 언급 된 코드를 사용했습니다. 이 코드를 사용할 때 사용자 이름과 암호를 인증 할 수 없습니다. 어느 한 PLZ 도와있다 .. 다음 코드 내가지고있어,이 후 인증을위한 텀블러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이다." plz 사람이 나를 인증하는 데 도움이.

+0

를 참조하십시오. 그러므로 404 – njzk2

답변

0

http://www.tumblr.com/api/authenticate 존재하지 않습니다. 따라서 HTTP404를 얻을 수 있습니다.

페이지가 존재하지 않는이

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

+0

위의 정보에 대한 감사합니다 – neelsnallu

+0

나는 위의 링크를 따라 텍스트를 게시하려고했지만 게시 할 수 없습니다. 액세스 토큰과 비밀 값을 얻었고 인증 성공 메시지를 받았습니다. 나는 다음 사용자 코드를 사용한다 : – neelsnallu

+0

HttpPost hpost = 새로운 HttpPost ("http://api.tumblr.com/v2/blog/"+ blogname.getText(). toString() + ".tumblr.com/post"); 목록 nameValuePairs = 새 ArrayList (2); nameValuePairs.add (새 BasicNameValuePair ("type", "text")); nameValuePairs.add (새 BasicNameValuePair ("title", title)); nameValuePairs.add (새 BasicNameValuePair ("body", body)); 시도 { hpost.setEntity (새 UrlEncodedFormEntity (nameValuePairs)); } 캐치 (예외 : UnsupportedEncodingException 전자) { 디버그 + = e.toString(); } – neelsnallu

관련 문제