NAME
Net::OpenXchange::Connection - Connection to OpenXchange server
VERSION
version 0.001
SYNOPSIS
Net::OpenXchange::Connection handles all the details of sending HTTP API requests to OpenXchange and decoding answers.
ATTRIBUTES
uri
Required constructor argument. URI to the HTTP API of your OpenXchange server. Please note you have to add the /ajax manually.
login
Required constructor argument. Username to log into OpenXchange.
password
Required constructor argument. Password to log into OpenXchange.
ua
Read-only. Instance of LWP::UserAgent which is used to send the requests.
session
Read-only. OpenXchange session ID.
METHODS
req_uri
my $uri = $conn->req_uri($path, %params);
$conn->req_uri('folder', action => 'root');
"https://ox.example.com/folder?action=root&session=abcdef&timezone=UTC"
Construct a URI for an API request. $path is appended to the base URI and %params is converted into query parameters. Common query parameters are added as well.
send
my $resdata = $conn->send($req);
Send the request and decodes the JSON response body. If there is an error, it throws Net::OpenXchange::X::HTTP for HTTP errors and Net::OpenXchange::X::OX for errors indicated by OX in the response body.
$req should be a HTTP::Request object which can be created by using the helper functions in HTTP::Request::Common.
use HTTP::Request::Common;
my $req = GET($conn->req_uri('login', action => 'logout'));
$conn->send($req);
AUTHOR
Maximilian Gass <maximilian.gass@credativ.de>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Maximilian Gass.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.