ArangoDB

Accessing Cap Constraints via Http




POST /_api/index (creates a cap constraint)

POST /_api/index?collection=collection-identifier

Creates a cap constraint for the collection collection-identifier, if it does not already exist. Expects an object containing the index details.

  • type: must be equal to "cap".
  • size: The maximal size of documents.

If the index does not already exists and could be created, then a HTTP 201 is returned. If the index already exists, then a HTTP 200 is returned.

If the collection-identifier is unknown, then a HTTP 404 is returned. It is possible to specify a name instead of an identifier.

Examples

Creating a cap collection

> curl --data @- -X POST --dump - http://localhost:8529/_api/index?collection=1786279
{ "type" : "cap", "size" : 10 }

HTTP/1.1 201 Created
content-type: application/json

{
  "size": 10,
  "code": 201,
  "id": "1786279/2769319",
  "type": "cap",
  "isNewlyCreated": true,
  "error": false
}