A Node.JS wrapper for Tumblr's API.
v0.2.0
var tumblr = require('tumblrrr'),
staff = tumblr('staff');
staff.read('account', function(data){
console.log('Title: ' + data['Title']);
});
var tumblr = require('tumblrrr'),
you = tumblr('you');
For POST-like methods you must pass email and password, otherwise it will return false. If the email or the password are incorrect it will return HTTP 403 (not authorized).
var tumblr = require('tumblrrr'),
you = tumblr('you', 'you@email.com', 'password');
Methods:
read
you.read([ read_api ], [ query ], callback(data));
If read_api
isn't set it will return data from /api/dashboard/json only if email and password are set, if they are not it returns data from /api/read/json.
-
read_api
account
posts
dashboard
-
query
- see parameters
delete
you.delete(id, callback);
reblog
you.reblog([ id, key ], callback);
you.reblog([ obj ], callback);
-
obj
-
{ id : number, key : 'string' [ , comment : 'string', as : 'string' ] }
like
you.like([ id, key ], callback);
you.like([ obj ], callback);
-
obj
-
{ id : number, key : 'string' }
unlike
you.unlike([ id, key ], callback);
you.unlike([ obj ], callback);
-
obj
-
{ id : number, key : 'string' }
write
you.write(obj, callback);
- For info about obj see this.
edit
you.edit(obj, callback)
- If
post-id
isn't set, it will return false. - You must pass all content parameters for the post's type (e.g. title, body for text posts) even if you are not changing their values.
- For more info about obj see this.
Debugging:
tumblr.debug = true
- Under maintenance, Tumblr will return HTTP 503.
- When sending queries,
id
is an alias forpost-id
just likekey
is forreblog-key
. - If a non-optional parameter isn't set when sending the query, it will return false.
- Issues
- Data from /api/authenticate and /api/likes are only available in XML and for now I don't want to be in any way dependent of other modules. Again: this is just for now.
- /api/read/json has often not been accessible, if that occurs the client will trigger an event error and it will return false when trying to connect.
- The Debugging system.
- Maybe working on a better syntax.
- Got some more ideas? Fork it, or let me know: mvrilo@gmail.com
See LICENSE