NAME

WWW::Tumblr::Blog

SYNOPSIS

my $blog = $t->blog('stuff.tumblr.com');
# or the domain name:
# my $blog = $t->blog('myblogontumblrandstuff.com');

# as per http://www.tumblr.com/docs/en/api/v2#blog-info
my $info = $blog->info;

# as per http://www.tumblr.com/docs/en/api/v2#blog-likes
my $likes = $blog->likes;
my $likes = $blog->likes(
    limit => 5,
    offset => 10,
);

# as per http://www.tumblr.com/docs/en/api/v2#photo-posts
my $posts = $blog->posts(
    type => 'photo',
    ... # etc
);

# Posting to the blog:

# using the source param:
my $post = $blog->post(
    type => 'photo',
    source => 'http://someserver.com/photo.jpg',
);

# using local files with the data param
# which needs to be an array reference
my $post = $blog->post(
    type => 'photo',
    data => [ '/home/david/larry.jpg' ],
);

# you can post multiple files, as per the Tumblr API:
my $post = $blog->post(
    type => 'photo',
    data => [ '/file1.jpg', 'file2.jpg', ... ],
);

# if the result was false (empty list), then do something with the
# error:
do_something_with_the_error( $tumblr->error ) unless $post;
                                                     # or $likes
                                                     # or $info
                                                     # or anything else

# Reblogging a post (photosets, text, anything):
# First get the post you want to reblog to obtain its reblog_key
my $source = $t->blog('someblog.tumblr.com');
my $posts = $source->posts(limit => 1);
my $original = $posts->{posts}[0];

# Then reblog it to your blog:
my $reblog = $blog->post_reblog(
    id         => $original->{id},
    reblog_key => $original->{reblog_key},
    comment    => 'Nice post!',  # optional
);

CAVEATS

  • I never really tried posting audios or videos.

  • Image format limitations: This module uses Tumblr's legacy posting API which only supports JPEG, PNG, and GIF images. Formats like WebP are not supported by the legacy API. If you try to upload a webp file, you'll get:

    Error 400: Mime type "image/webp" not supported from file

    This is a Tumblr API limitation, not a bug in this module. Tumblr's web interface uses their newer NPF (Neue Post Format) which supports more formats. NPF support would require significant changes to this module and is tracked as a future enhancement. See https://www.tumblr.com/docs/npf for NPF documentation.

  • Video uploads: Direct video file uploads have similar limitations. The legacy API primarily supports video via embed URLs (YouTube, Vimeo, etc.) rather than direct file uploads.

BUGS

Please refer to WWW::Tumblr.

AUTHOR(S)

The same folks as WWW::Tumblr.

SEE ALSO

WWW::Tumblr, WWW::Tumblr::ResponseError.

COPYRIGHT and LICENSE

Same as WWW::Tumblr.