++ed by:

1 non-PAUSE user.

Ersun Warncke
and 1 contributors

NAME

ArangoDB2 - ArangoDB 2.x HTTP API Interface

SYNOPSIS

    my $arango = ArangoDB2->new('http://localhost:8259', 'username', 'password');

    $arango->database('foo')->create;
    $aragno->database('foo')->collection('bar')->create;

    my $doc = $arango->database('foo')->collection('bar')->document->create({
        hello => 'world'
    });

    $doc->update({hello => 'bob'});

DESCRIPTION

ArangoDB2 implements the ArangoDB 2.x HTTP API interface.

Most of the API surface is implemented with the exception of:

    Async Results
    Bulk Imports
    Batch Requests
    Sharding
    Simple Queries

The use of ETags to control modification operations has not been implemented.

The public interface should be stable at this point. The internal plumbing will likely continue to evolve.

See the official docs for details on the API: https://docs.arangodb.com

CONVENTIONS

Parameters for API calls can be set either with setter methods or as arguments to the method call.

    $arango->database->name('foo')->create;
    $arango->database->create({name => 'foo'});

The major difference between these two approaches is that when a parameter is passed as an argument it is not stored. If a parameter is set on the object, then subsequent requests will continue to use that parameter.

    # collection will be created
    $doc1->createCollection(1)->create({foo => 'bar'});
    # collection will also be created
    $doc1->create({foo => 'bar'});

    # collection will be created
    $doc2->create({foo => 'bar'}, {createCollection => 1});
    # collection will not be created
    $doc2->create({foo => 'bar'});

Databases, collections, documents, indexes, and other objects are registered and cached by name. This will be made optional in the future.

    # creates a new instance of database
    $db = $arango->database('foo');
    # returns the previously created instance
    $arango->database('foo');

When you retrieve a document, edge, or other object by name this may result in a GET query to fetch the details for that object. If you use the name method to set the name of the object after it is created this GET can be avoided.

    # performs a GET
    $doc1 = $collection->document('foo');
    # does not perform a GET
    $doc2 = $collection->document->name('foo');

When you access an object by name this will return an existing cached version of the object if it exists. If you leave out the name this will bypass the object register / cache.

    # uses cached object if it exists
    $doc1 = $collection->document('foo');
    # does not use cached object even it it exists
    $doc2 = $collection->document->name('foo');

Wherever possible the naming of methods and parameters has been kept the same as the names used by the API. The structure of ArangoDB2 attempts to mirror the structure of the API as closely as possible. This should make it easy to refer to the official ArangoDB API documentation when using ArangoDB2.

ArangoDB2 does not attempt to validate parameters. The only validation that takes place is to insure that bool parameters have properly encoded JSON true and false values.

METHODS

new
admin
database
databases
endpoint
http
http_client

Get/set string indicating which HTTP backend to use. Currently supported values are 'lwp' and 'curl'. Using curl requires WWW::Curl, which will be used by default if it is installed.

API METHODS

version

GET /_api/version

Returns the server name and version number.

PROPERTY METHODS

uri

URI of ArangoDB endpoint.

password

Password to use when accessing ArangoDB.

username

Username to use when accessing ArangoDB.

SEE ALSO

ArangoDB

AUTHOR

Ersun Warncke, <ersun.warncke at outlook.com>

http://ersun.warnckes.com

COPYRIGHT

Copyright (C) 2014 Ersun Warncke

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.