Search code examples
javascriptnode.jsmoduletumblr

How to post Photo Blog to tumblr with the "tumblr.js" NodeJS module


I'm using the tumblr.js node module for the Tumblr API, and have looked through their docs but can't figure out what is suppose to be in "options" when I blog something. All I've done thus far with this module is fetched my tumblr followers. My concerns for posting are as follow:

  • How to specify tags.
  • How to upload the photo from a local file ( or web address if that's all I can do. )
  • How to specify the caption.
  • How to specify the title.

Reference Code:

var tumblr = require('tumblr.js');

var client= tumblr.createClient({

    consumer_key: '*',
    consumer_secret: '*',
    token: '*',
    token_secret: '*'

});

client.photo("xymonsinclair", options, callback);

Thanks a bunch!


Solution

  • In "options" you may set an object containing the properties for that photo post. The parameters available are listed here http://www.tumblr.com/docs/en/api/v2#pphoto-posts.

    Example:

    var tumblr = require('tumblr.js');
    
    var client= tumblr.createClient({
    
        consumer_key: '*',
        consumer_secret: '*',
        token: '*',
        token_secret: '*'
    
    });
    
    // todo: set up your options
    var options = {
        caption: '',
        link: '',
        source: '',
        data: []
    };
    
    client.photo("xymonsinclair", options, callback);