ArangoDB v3.13 is under development and not released yet. This documentation is not final and potentially incomplete.
HTTP interface for user-defined AQL functions
The HTTP API for user-defined functions (UDFs) lets you add, delete, and list registered AQL extensions
AQL user functions are a means to extend the functionality of ArangoDB’s query language (AQL) with user-defined JavaScript code.
For an overview of over AQL user functions and their implications, please refer to Extending AQL.
All user functions managed through this interface are stored in the
_aqlfunctions
system collection. You should not modify the documents in this
collection directly, but only via the dedicated interfaces.
Create a user-defined AQL function
Registers a user-defined function (UDF) written in JavaScript for the use in AQL queries in the current database.
In case of success, HTTP 200 is returned. If the function isn’t valid etc. HTTP 400 including a detailed error message will be returned.
isDeterministic boolean
an optional boolean value to indicate whether the function results are fully deterministic (function return value solely depends on the input value and return value is the same for repeated calls with same input). The
isDeterministic
attribute is currently not used but may be used later for optimizations.
Examples
curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/aqlfunction
{
"name": "myfunctions::temperature::celsiustofahrenheit",
"code": "function (celsius) { return celsius * 1.8 + 32; }",
"isDeterministic": true
}
Remove a user-defined AQL function
name
from the current database.group string
true
: The function name provided inname
is treated as a namespace prefix, and all functions in the specified namespace will be deleted. The returned number of deleted functions may become 0 if none matches the string.false
: The function name provided inname
must be fully qualified, including any namespaces. If none matches thename
, HTTP 404 is returned.
Examples
deletes a function:
curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/aqlfunction/square::x::y
function not found:
curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/aqlfunction/myfunction::x::y
List the registered user-defined AQL functions
Returns all registered user-defined functions (UDFs) for the use in AQL of the current database.
The call returns a JSON array with status codes and all user functions found under result
.
200 OK
on success HTTP 200 is returned.
result* array of objects
All functions, or the ones matching the
namespace
parameterisDeterministic* boolean
an optional boolean value to indicate whether the function results are fully deterministic (function return value solely depends on the input value and return value is the same for repeated calls with same input). The
isDeterministic
attribute is currently not used but may be used later for optimizations.
Response Body application/json object
Examples
curl --header 'accept: application/json' --dump - http://localhost:8529/_api/aqlfunction/test