2013-07-11 2 views
0
{"meta":{"status":401,"msg":"Not Authorized"},"response":[]} 

Tumblr는 게시하는 동안 위 결과를 제공합니다.tumblr를 사용하여 이미지 게시

DefaultHttpClient client = new DefaultHttpClient(); 
HttpResponse resp = null; 
String result = null; 
HttpPost hpost = new HttpPost("http://api.tumblr.com/v2/blog/" + username    
                 +".tumblr.com/post"); 
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); 
nameValuePairs.add(new BasicNameValuePair("type", "photo")); 
nameValuePairs.add(new BasicNameValuePair("caption", "hello")); 
nameValuePairs.add(new BasicNameValuePair("source", "url_of_the_image")); 


     String debug = ""; 
     try { 
      hpost.setEntity(new UrlEncodedFormEntity(
        nameValuePairs)); 
      consumer.sign(hpost); 
      resp = client.execute(hpost); 
      result = EntityUtils.toString(resp.getEntity()); 
      Log.v("result >>", result); 
     } catch (UnsupportedEncodingException e) { 
      debug += e.toString(); 
     } catch (OAuthMessageSignerException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } catch (OAuthExpectationFailedException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } catch (OAuthCommunicationException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } catch (ClientProtocolException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } catch (IOException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 

tumblr에서 이미지를 게시해야합니다. 해결책을 좀주세요.

답변

0

타사 라이브러리 사용을 고려해 보셨습니까? Temboo SDK (무료 계정 필요)에는 사진 URL 또는 Base64로 인코딩 된 사진 콘텐츠를 전달하여 Tumblr 사진 게시물을 만드는 방법이 포함되어 있습니다. 에서 살펴 보자 :

https://www.temboo.com/library/Library/Tumblr/Post/CreatePhotoPostWithURL/https://www.temboo.com/library/Library/Tumblr/Post/CreatePhotoPostWithImageFile/

전체 공개 - 나는 Temboo에서 작동합니다.

관련 문제