android - Posting image using tumblr -


 {"meta":{"status":401,"msg":"not authorized"},"response":[]} 

tumblr gives above result while posting image.

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();         } 

i need post image in tumblr. give me solutions.

have considered using third-party library? temboo sdk (free account required) includes methods create tumblr photo posts either passing photo url or base64 encoded content of photo. take at:

https://www.temboo.com/library/library/tumblr/post/createphotopostwithurl/ https://www.temboo.com/library/library/tumblr/post/createphotopostwithimagefile/

full disclosure -- work @ temboo.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -