Building Hypermedia APIs with FoxxGenerator: ArangoDB Tutorial

This is the third and final part of Lucas blog series about building hypermedia APIs. In the previous part, we identified the needed transitions and collected some information about each of them. Begin with blog post one to get familiar with concepts on Hypermedia and JSON.

We can now describe the identified transitions using FoxxGenerator. To make the most common case simple, it defaults to the type follow. Therefore defining our four follow transitions is easy using FoxxGenerator:

generator.defineTransition('books');
generator.defineTransition('users');
generator.defineTransition('item');
generator.defineTransition('likes');

Note that at this point we are just defining the transitions, we are not adding them to the statemachine we are describing with the help of FoxxGenerator. In the case of creating a book, we need to add additional information. First of, it is a connect transition. Secondly we also need to define the parameters that this transition needs:

generator.defineTransition('createBook', {
  type: 'connect',

  parameters: {
    title: Joi.string()
  }
});

(more…)

More info...

Building Hypermedia APIs: Design Principles & Best Practices

This is the second blog post on building hypermedia APIs with the focus on API design. In part 1 Lucas describes the concept of links in JSON.

Imagine we have an API where people can like books and other people can then see, who likes a certain book. We want this API to be highly connected: We don’t want to look up URLs in a documentation, we want to follow links as we know it from the world wide web. All we want to do as the author of the API is give our users a single URL from which they can then follow links to all other resources. This is similar to the way we would do this with a website. Leonard Richardson and Mike Amundsen refer to this as the billboard URL for this reason: If you put this URL on some billboard, people know everything to get started with your API. (more…)

More info...

November Recap: ArangoDB Updates & Highlights

November 2014 was a month where our staff (and the cute ArangoDB Foxx) collected lot's of miles by visiting conferences, meetups and inspiring people in Europe, Africa, the US and Canada. If you missed a talk, there are plenty of slideshares / recordings available.

Release 2.3

Everyone who was not on a plane worked on ArangoDB 2.3 - our major release with a re-written query optimizer that optimizes execution plans, added/improved AQL functions and several performance improvements (@see Query Optimizer Tour by Jan). You can download ArangoDB 2.3.1 and start optimizing.

Frank added a docker file, so you might start shipping ArangoDB in a docker container as well.

Extensibility Framework Foxx

Our JavaScript extensibility framework Foxx (@see this new 2:45min ArangoDB Foxx intro by Lucas) also benefits from our 2.3 release, adding job queues and session handling for Foxx apps, plus 3 bundled apps for user management, session and authentication.

https://twitter.com/okiess/status/538656260577828864

With a blog post series started last week on Building Hypermedia APIs Lucas introduces the concepts of hypermedia in JSON. The second post will follow later today, explaining how to design a complete web API with a state-chart / state-machine. Finaly, the third post will describe how you can use the new FoxxGenerator (upcoming 2.4 release) to build your API.

Can't wait? Then use our newly introduced ArangoDB technical previews to get your hands on our latest features. The 2.4.1 technical preview can be used to test the FoxxGenerator feature.

ArangoDB Driver Support

We also worked on a new Java Driver which is fully documented and comes with an additional blog post on Graph handling with the Java Driver.

Great effort from the community leads to several more driver updates, improved documentation and ArangoDB 2.3 support. Have a look at the drivers page to see if your favorite programming language is one of the 16 supported.

Cookbook - Recipes to make with ArangoDB

We have introduced an ArangoDB Cookbook as a developers source that provides easy to use recipes for common tasks / problems to solve in or with ArangoDB. Recipes explain how-to start a docker container with ArangoDB, Fulldepth graph traversals or how to write your first Foxx app.

ArangoDB Cookbook

Please add your recipes via Github to extend this resource for relevant hands-on solutions!

Blog Posts

Several blog posts you might have missed last month:

#FoxxOnTour

This month we didn't only work on several releases, we also flew around the world visiting many conferences, user groups and awesome people, guarded by our lovely Foxx. Places we've been in November:

And here are some pictures of our Foxx having fun at different places all around the world, tagged with #FoxxOnTour:

More info...

ArangoDB 2.3.1 Release: Enhancements & Bug Fixes

This version is deprecated. Download the new version of ArangoDB

A maintenance release for ArangoDB 2.3 is available from our download page and through the package manager.

  • recreate password if missing during upgrade
  • fixed issue #1126
  • fixed non-working subquery index optimizations
  • do not restrict summary of Foxx applications to 60 characters
  • fixed display of “required” path parameters in Foxx application documentation
  • added more optimizations of constants values in AQL FILTER conditions
  • fixed invalid or-to-in optimization for FILTERs containing comparisons with boolean values
  • fixed replication of _graphs collection
  • added AQL list functions PUSH, POP, UNSHIFT, SHIFT, REMOVE_VALUES, REMOVE_VALUE, REMOVE_NTH and APPEND
  • added AQL functions CALL and APPLY to dynamically call other functions
  • fixed AQL optimizer cost estimation for LIMIT node
  • prevent Foxx queues from permanently writing to the journal even when server is idle
  • fixed AQL COLLECT statement with INTO clause, which copied more variables than v2.2 and thus lead to too much memory consumption. This deals with #1107.
  • fixed AQL COLLECT statement, this concerned every COLLECT statement, only the first group had access to the values of the variables before the COLLECT statement. This deals with #1127.
  • fixed some AQL internals, where sometimes too many items were fetched from upstream in the presence of a LIMIT clause. This should generally improve performance.
More info...

Building a Hypermedia API with JSON: ArangoDB Tutorial

When we create websites we don’t just create single pages that have no connection to other Web pages. From the beginning, hyperlinks were part of the core concept of the World Wide Web and for that reason HTML. Links are so essential to the Web that they are even used to rank the popularity of the Web pages on search engines. And who hasn’t gone on a journey through Wikipedia clicking link after link? Even though we all know and appreciate the importance of links on Websites, we rarely use links in our Web APIs. (more…)

More info...

Running ArangoDB Made Simple: Step-by-Step Guide

docker run -p 8529:8529 arangodb/arangodb

I've created an automated build repository on docker, so that you can easily start a docker container with the latest stable release. If you miss anything in the container, please let me know. Thanks to frodenas, hipertracker, joaodubas, webwurst who also created dockerfiles.

ArangoDB

A distributed open-source database with a flexible data model for documents, graphs, and key-values. Build high performance applications using a convenient sql-like query language or JavaScript extensions.

Start a ArangoDB instance

In order to start an ArangoDB instance run

unix> docker run --name arangodb-instance -d arangodb/arangodb

By default ArangoDB listen on port 8529 for request and the image includes EXPOST 8529. If you link an application container, it is automatically available in the linked container. See the following examples.

Using the instance

In order to use the running instance from an application, link the container

unix> docker run --name my-app --link arangodb-instance

Running the image

In order to start an ArangoDB instance run

unix> docker run -p 8529:8529 -d arangodb/arangodb

ArangoDB listen on port 8529 for request and the image includes EXPOST 8529. The -p 8529:8529 exposes this port on the host.

Command line options

In order to get a list of supported options, run

unix> docker run -e help=1 arangodb/arangodb

Persistent Data

ArangoDB use the volume /data as database directory to store the collection data and the volume /apps as apps directory to store any extensions. These directory are marked as docker volumes.

See docker run -e help=1 arangodb for all volumes.

A good explanation about persistence and docker container can be found here: Docker In-depth: Volumes, Why Docker Data Containers are Good Using host directories

Using host directories

You can map the container's volumes to a directory on the host, so that the data is kept between runs of the container. This path /tmp/arangodb is in general not the correct place to store you persistent files - it is just an example!

unix> mkdir /tmp/arangodb
unix> docker run -p 8529:8529 -d \
          -v /tmp/arangodb:/data \
          arangodb

This will use the /tmp/arangodb directory of the host as database directory for ArangoDB inside the container. Using a data container

Using a data container

Alternatively you can create a container holding the data.

unix> docker run -d --name arangodb-persist -v /data ubuntu:14.04 true

And use this data container in your ArangoDB container.

unix> docker run --volumes-from arangodb-persist -p 8529:8529 arangodb
unix> docker run -d --name arangodb-persist -v /data tianon/true true

Images

Building an image

Simple clone the repository and execute the following command in the arangodb-docker folder

unix> docker build -t arangodb .

This will create a image named arangodb.

More info...

ArangoDB 2.2.7 Release: Enhancements & Bug Fixes

This version is deprecated. Download the new version of ArangoDB

A maintenance release for ArangoDB 2.2 is available from the usual channels.

v2.2.7 (2014-11-19)

  • fixed issue #1079: AQL editor: keyword WITH in UPDATE query is not highlighted
  • fix memory leak in cluster nodes
  • fixed registration of AQL user-defined functions in Web UI (JS shell)
  • fixed error display in Web UI for certain errors (now error message is printed instead of ‘undefined’)
  • fixed issue #1059: bug in js module console
  • fixed issue #1056: “fs”: zip functions fail with passwords
  • fixed issue #1063: Docs: measuring unit of –wal.logfile-size?
  • fixed issue #1062: Docs: typo in 14.2 Example data

The 2.2.7 Documentation: Click here

More info...

ArangoDB Cookbook: Recipes for Database Optimization

It’s new – and just for you! With the new ArangoDB Cookbook we want to guide you thru various challenges that might arise in your daily business with NoSQL – and ArangoDB in particular.

You have a problem with or need an introduction to NoSQL data modeling / scaling ArangoDB / building Foxx apps / graph processing or something related to your favorite programming language? Then have a look if there’s a recipe match in the Cookbook!

Create your own recipes and help others in the ArangoDB community. We appreciate every participation that makes the cookbook a valuable source for ArangoDB users. Just write your problem description and solution in plain markdown and start a pull request on Github.

Need an example?

Lets assume you checked the foxx introduction on our website and now you want to build your own Foxx app, but you don’t know how to start.

(more…)

More info...

ArangoDB 2.3 Release: New Features & Enhancements

This version is deprecated. Download the new version of ArangoDB

The new query optimizer is ready to rock the world. We are proud to announce the release of ArangoDB 2.3, available for download now. ArangoDB 2.3 is available for Linux, Windows and Mac and provides support for 16 programming languages.

Overhauled Query Optimizer

The query optimizer and executor for AQL queries have been completely overhauled. Especially the optimization of distributed queries has been improved significantly.

The query optimizer can now apply much more optimizations than in previous versions of ArangoDB. We have tried to keep the new version as compatible as possible with ArangoDB 2.2.

Have a look at Jan’s blog post “Tour around new AQL query optimizer” or read the optimizer documentation to get familiar with this new feature.

Powerful Foxx Enhancements

We can’t wait to get your feedback, so we’ve released some great new Foxx features in 2.3 with more to come in the next release.

With the new job queues feature you can run async jobs to communicate with external services, Foxx queries make writing complex AQL queries much easier and Foxx sessions will handle the authentication and session hassle for you. (more…)

More info...

ArangoDB Java Driver for Graphs: Enhanced Functionality

After defining a graph and filling it with some vertices and edges (see part 1), the time has come to retrieve information out of the graph.

Please take a look at the defined graph operations of ArangoDB. These will be the base for our next examples. (Yes, there may be other ways to get the results, this post does not claim completeness!)

We will start with some easy stuff and then smoothly advance in complexity.

Question: “How many edges are defined within the graph?”

(more…)

More info...

Get the latest tutorials,
blog posts and news: