Net::API::Gett - Perl bindings for API


Version 1.06


    use 5.010;
    use Net::API::Gett;

    # Get API Key from

    my $gett = Net::API::Gett->new( 
        api_key      => 'GettAPIKey',
        email        => '',
        password     => 'mysecret',

    my $file_obj = $gett->upload_file( 
        filename => "ossm.txt",
        contents => "/some/path/example.txt",
           title => "My Awesome File", 
        encoding => ":encoding(UTF-8)" 

    say "File has been shared at " . $file_obj->getturl;

    # Download contents
    my $file_contents = $file_obj->contents();

    open my $fh, ">:encoding(UTF-8)", "/some/path/example-copy.txt" 
        or die $!;
    print $fh $file_contents;
    close $fh;

    # clean up share and file(s)
    my $share = $gett->get_share($file->sharename);


Gett is a clutter-free file sharing service that allows its users to share up to 2 GB of files for free. They recently implemented a REST API; this is a binding for the API. See for full details and how to get an API key.


This library is more encapsulated. Share functions which act on shares are in the Net::API::Gett::Share object namespace, and likewise with files. Future versions of this library will modify the Request and User objects to be roles rather than objects.



Net::API::Gett::User object. has_user() predicate.


Net::API::Gett::Request object.


Unless otherwise noted, these methods die if an error occurs or if they get a response from the API which is not successful. If you need to handle errors more gracefully, use Try::Tiny to catch fatal errors.


Constructs a new object. Optionally accepts:

  • A API key, email, and password, or,

  • A refresh token, or,

  • A access token

If any of these parameters are passed, they will be proxied into the Net::API::Gett::User object which will then permit you to make authenticated API calls. Without an access token (or the means to acquire one) only non-authenticated calls are allowed; they are: get_share(), get_file(), $file->thumbnail() and $file->contents().

Share functions

All of these functions cache Net::API::Gett::Share objects. Retrieve objects from the cache using the shares method. Use the get_share method to update a cache entry if it is stale.


Retrieves all share information for the given user. Takes optional scalar integers offset and limit parameters, respectively.

Returns an unordered list of Net::API::Gett::Share objects.


Retrieves (and/or refreshes cached) information about a specific single share. Requires a sharename parameter. Does not require an access token to call.

Returns a Net::API::Gett::Share object.


This method creates a new share instance to hold files. Takes an optional string scalar parameter which sets the share's title attribute.

Returns the new share as a Net::API::Gett::Share object.

File functions


Returns a Net::API::Gett::File object given a sharename and a fileid. Does not require an access token to call.


This method uploads a file to Gett. The following key/value pairs are valid:

  • filename (required)

    What to call the uploaded file when it's inside of the Gett service.

  • sharename (optional)

    Where to store the uploaded file. If not specified, a new share will be automatically created.

  • title (optional)

    If specified, this value is used when creating a new share to hold the file. It will not change the title of an existing share. See the update() method on the share object to do that.

  • content (optional)

    A synonym for contents. (Yes, I've typo'd this too many times.) Anything in contents has precedent, if they're both specified.

  • contents (optional)

    A representation of the file's contents. This can be one of:

    • A buffer (See note below)

    • An IO::Handle object


    • A pathname to a file to be read

    If not specified, the filename parameter is treated as a pathname. This attempts to be DWIM, in the sense that if contents contains a value which is not a valid filename, it treats contents as a buffer and uploads that data.

  • encoding

    An encoding scheme for the file content. By default it uses :raw. See perldoc -f binmode for more information about encodings.

  • chunk_size

    The chunk_size in bytes to use when uploading a file. Defaults to 1 MB.

Returns a Net::API::Gett:File object representing the uploaded file.


This method populates/updates the Net::API::Gett:Share object local cache.

It returns undef if the passed value isn't a Net::API::Gett::Share object.


This method retrieves one or more cached Net::API::Gett::Share objects. Objects are requested by sharename. If no parameter list is specified, all cached objects are returned in an unordered list. (The list will not be in the order shares were added to the cache.)

If no objects are cached, this method returns an empty list.


Mark Allen, <mrallen1 at yahoo dot com>


Please report any bugs or feature requests to bug-net-api-gett at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc Net::API::Gett

You can also look for information at:


Gett API documentation


Thanks to the following for patches:


Copyright 2011 Mark Allen.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.