You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Motivation

The purpose of this document is to outline the design of refactored HTTP (aka REST) API for AsterixDB.

The reason for HTTP API refactoring is threefold:

 

  • Currently we have various REST endpoints (/ddl, /query, /update, /aql, /queryService), which do similar things (parsing parameters out of the request parameters, assembling the response) but each endpoint does it in a slightly different manner. All of that should be refactored to use the common base endpoint, which . At the same time old endpoints could be kept for backwards-compatibility if that it really needed.

  • Current Web interface does the server-side HTML generation and does not use REST calls whatsoever. It would be better to eat our own dog food here and switch to assembling the result on the client side using JavaScript. Especially since we have a potential GSoC project proposal to build such JS-based interface.

  • As we are moving towards having more query languages under AsterixDB umbrella (AQL, SQL++, XQuery\JSONiq as a part of VXQuery) it would be nice to design a generic language-agnostic REST API, which later could be reused by VXQuery since it's also lacking proper API as of now.

Tools and existing APIs

The design is inspired by N1QL REST API (http://developer.couchbase.com/documentation/server/4.1/n1ql/n1ql-rest-api/index.html) since it is an example of wel thoguht API in the similar system. I believe we don't need to be 100% compatible, although it would be nice to be to reuse the same clients.

We might also consider use Swagger (http://swagger.io/) to describe the API. This library will allow users to seamlessly generate client SDKs in their favorite language, which is especially usefully since we don't provide drivers for any clients. Here is the complete set of features which Swagger will allow us to do:

  • Describe API in developer-friendly way by creating yaml description.
  • Validate correctness of the server-side implementation.
  • Generate client-side SDK for various languages.
  • Generate documentation for API.

REST Endpoints

Proposed API consists of 3 endpoints: Query, Status and Result. The latter two are needed only in a case of asynchronous data delivery, while the former is the main endpoint and serves as an entry point for all client requests.

  • No labels