HTTP interface for search-alias Views

The HTTP API for Views lets you manage search-alias Views, including adding and removing inverted indexes

Create a search-alias View

Creates a search-alias View

POST /_api/view

Request Body

  • name (string, required): The name of the View.

  • type (string, required): The type of the View. Must be equal to "search-alias". This option is immutable.

  • indexes (array, optional): A list of inverted indexes to add to the View.

    • collection (string, required): The name of a collection.

    • index (string, required): The name of an inverted index of the collection, or the index ID without the <collection>/ prefix.

Creates a new View with a given name and properties if it does not already exist.

Responses

HTTP 400: If the name or type attribute are missing or invalid, then an HTTP 400 error is returned.

HTTP 409: If a View called name already exists, then an HTTP 409 error is returned.

Examples

shell> curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/view <<EOF
{ 
  "name" : "testViewBasics", 
  "type" : "search-alias" 
}
EOF

HTTP/1.1 201 Created
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 114
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
Show response body

Return information about a View

returns a View

GET /_api/view/{view-name}

Path Parameters

  • view-name (string, required): The name of the View.

The result is an object briefly describing the View with the following attributes:

  • id: The identifier of the View
  • name: The name of the View
  • type: The type of the View as string

Responses

HTTP 404: If the view-name is unknown, then a HTTP 404 is returned.

Examples

Using an identifier:

shell> curl --header 'accept: application/json' --dump - http://localhost:8529/_api/view/70883

HTTP/1.1 200 OK
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 120
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
Show response body

Using a name:

shell> curl --header 'accept: application/json' --dump - http://localhost:8529/_api/view/testView

HTTP/1.1 200 OK
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 120
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
Show response body

Read properties of a View

reads the properties of the specified View

GET /_api/view/{view-name}/properties

Path Parameters

  • view-name (string, required): The name of the View.

Returns an object containing the definition of the View identified by view-name.

The result is an object with a full description of a specific View, including View type dependent properties.

Responses

HTTP 400: If the view-name is missing, then a HTTP 400 is returned.

HTTP 404: If the view-name is unknown, then a HTTP 404 is returned.

Examples

Using an identifier:

shell> curl --header 'accept: application/json' --dump - http://localhost:8529/_api/view/70893/properties

HTTP/1.1 200 OK
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 496
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
Show response body

Using a name:

shell> curl --header 'accept: application/json' --dump - http://localhost:8529/_api/view/products/properties

HTTP/1.1 200 OK
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 496
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
Show response body

List all Views

returns all Views

GET /_api/view

Returns an object containing a listing of all Views in a database, regardless of their type. It is an array of objects with the following attributes:

  • id
  • name
  • type

Responses

HTTP 200: The list of Views

Examples

Return information about all Views:

shell> curl --header 'accept: application/json' --dump - http://localhost:8529/_api/view

HTTP/1.1 200 OK
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 127
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
Show response body

Changes properties of a search-alias View

Changes the properties of a search-alias View

PUT /_api/view/{view-name}/properties

Path Parameters

  • view-name (string, required): The name of the View.

Request Body

  • indexes (array, optional): A list of inverted indexes for the View.

    • collection (string, required): The name of a collection.

    • index (string, required): The name of an inverted index of the collection, or the index ID without the <collection>/ prefix.

Replaces the list of indexes of a search-alias View.

Responses

HTTP 200: On success, an object with the following attributes is returned:

  • id (string): The identifier of the View.

  • name (string): The name of the View.

  • type (string): The View type ("search-alias").

  • indexes (array): The list of inverted indexes that are part of the View.

    • collection (string): The name of a collection.

    • index (string): The name of an inverted index of the collection.

HTTP 400: If the view-name is missing, then a HTTP 400 is returned.

HTTP 404: If the view-name is unknown, then a HTTP 404 is returned.

Examples

shell> curl -X PUT --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/view/products/properties <<EOF
{ 
  "indexes" : [ 
    { 
      "collection" : "books", 
      "index" : "inv_descr" 
    } 
  ] 
}
EOF

HTTP/1.1 200 OK
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 150
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
Show response body

Partially changes properties of a search-alias View

Partially changes properties of a search-alias View

PATCH /_api/view/{view-name}/properties

Path Parameters

  • view-name (string, required): The name of the View.

Request Body

  • indexes (array, optional): A list of inverted indexes to add to or remove from the View.

    • collection (string, required): The name of a collection.

    • index (string, required): The name of an inverted index of the collection, or the index ID without the <collection>/ prefix.

    • operation (string, optional): Whether to add or remove the index to the stored indexes property of the View. Possible values: "add", "del". The default is "add".

Updates the list of indexes of a search-alias View.

Responses

HTTP 200: On success, an object with the following attributes is returned:

  • id (string): The identifier of the View.

  • name (string): The name of the View.

  • type (string): The View type ("search-alias").

  • indexes (array): The list of inverted indexes that are part of the View.

    • collection (string): The name of a collection.

    • index (string): The name of an inverted index of the collection.

HTTP 400: If the view-name is missing, then a HTTP 400 is returned.

HTTP 404: If the view-name is unknown, then a HTTP 404 is returned.

Examples

shell> curl -X PATCH --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/view/products/properties <<EOF
{ 
  "indexes" : [ 
    { 
      "collection" : "books", 
      "index" : "inv_descr" 
    } 
  ] 
}
EOF

HTTP/1.1 200 OK
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 193
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
Show response body

Rename a View

renames a View

PUT /_api/view/{view-name}/rename

Path Parameters

  • view-name (string, required): The name of the View to rename.

Renames a View. Expects an object with the attribute(s)

  • name: The new name

It returns an object with the attributes

  • id: The identifier of the View.
  • name: The new name of the View.
  • type: The View type.

Note: This method is not available in a cluster.

Responses

HTTP 400: If the view-name is missing, then a HTTP 400 is returned.

HTTP 404: If the view-name is unknown, then a HTTP 404 is returned.

Examples

shell> curl -X PUT --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/view/products1/rename <<EOF
{ 
  "name" : "viewNewName" 
}
EOF

HTTP/1.1 200 OK
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 123
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
Show response body

Drops a View

drops a View

DELETE /_api/view/{view-name}

Path Parameters

  • view-name (string, required): The name of the View to drop.

Drops the View identified by view-name.

If the View was successfully dropped, an object is returned with the following attributes:

  • error: false
  • id: The identifier of the dropped View

Responses

HTTP 400: If the view-name is missing, then a HTTP 400 is returned.

HTTP 404: If the view-name is unknown, then a HTTP 404 is returned.

Examples

Using an identifier:

shell> curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/view/70873

HTTP/1.1 200 OK
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 40
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
Show response body

Using a name:

shell> curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/view/testView

HTTP/1.1 200 OK
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 40
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
Show response body