WWW::Freebox - Access to FreeboxOS API
Version 0.01
Before using this module in your script(s) you need to acquire a token and a ID.
use WWW::Freebox; my $fbx = WWW::Freebox->new("mafreebox.freebox.fr"); my $app_id = "perl.helloworld"; my $app_name = "Perl script"; my $app_version = "1.0"; my $device_name = "John's computer"; # You have to launch this method only once because a unique token and a unique ID are required per application. my ($app_token, $track_id) = $fbx->authorize($app_id, $app_name, $app_version, $device_name); # You need to store $app_token and $track_id (in a config file for example) # You will have to grant access to your application (a message will be displayed on LCD screen of the Freebox Server)
Once you've got the token and the ID you will be able to use the module as follow :
use WWW::Freebox; my $fbx = WWW::Freebox->new("mafreebox.freebox.fr"); $fbx->login("perl.helloworld", $app_token, $track_id); if($fbx->{permissions}{downloader}){ # Doing a request to FreeboxOS API my $content = [download_dir => 'path', download_file => ['file.torrent']]; my $jsonResponse = $fbx->request("downloads/add", 1, $content); }
You can find more informations at http://dev.freebox.fr/sdk/os/.
my $fbx = WWW::Freebox->new("mafreebox.freebox.fr");
my ($app_token, $track_id) = $fbx->authorize("perl.helloworld", "Perl script", "1.0", "John's computer");
$fbx->login("perl.helloworld", $app_token, $track_id);
# Possible values for the second parameter (method): # 0: GET # 1: POST # 2: PUT # 3: DELETE my $jsonResponse = $fbx->request("downloads/", 0); my $content = '{"io_priority": "high","status": "stopped"}'; my $jsonResponse = $fbx->request("downloads/16", 2, $content); my @content = [download_dir => 'path', download_file => ['file.torrent']]; my $jsonResponse = $fbx->request("downloads/add", 1, @content);
$fbx->logout();
$fbx->close();
Alexandre van Beurden, <alexandre.vanbeurden.dev(at)gmail.com>
<alexandre.vanbeurden.dev(at)gmail.com>
Please report any bugs or feature requests to bug-www-freebox at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Freebox. You can also open an issue at https://github.com/KiLlOrBe/PM-Freebox.
bug-www-freebox at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc WWW::Freebox
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Freebox
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/WWW-Freebox
CPAN Ratings
http://cpanratings.perl.org/d/WWW-Freebox
Search CPAN
http://search.cpan.org/dist/WWW-Freebox/
If you need help or you have any question about this module feel free to email me.
Copyright 2015 Alexandre van Beurden.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install WWW::Freebox, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Freebox
CPAN shell
perl -MCPAN -e shell install WWW::Freebox
For more information on module installation, please visit the detailed CPAN module installation guide.