{
"basePath": "/",
"swaggerVersion": "1.1",
"apiVersion": "0.1",
"apis": [
{
"operations": [
{
"errorResponses": [],
"parameters": [
{
"dataType": "String",
"paramType": "path",
"required": false,
"name": "id",
"description": "The id of the task to fetch.
"
}
],
"notes": "fetches all existing tasks on the server; optionally just the one specified by id
",
"summary": " Fetch all tasks or one task with id",
"httpMethod": "GET",
"examples": "
Getting all tasks:
shell> curl --dump - http://localhost:8529/_api/tasks\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n[ \n { \n \"id\" : \"21570613\", \n \"name\" : \"user-defined task\", \n \"type\" : \"periodic\", \n \"period\" : 1, \n \"created\" : 1430810903.549796, \n \"command\" : \"(function () {\\n require('org/arangodb/foxx/queues/manager').manage();\\n })(params)\", \n \"database\" : \"_system\" \n }, \n { \n \"id\" : \"statistics-collector\", \n \"name\" : \"statistics-collector\", \n \"type\" : \"periodic\", \n \"period\" : 10, \n \"created\" : 1430810902.616952, \n \"command\" : \"require('org/arangodb/statistics').historian();\", \n \"database\" : \"_system\" \n }, \n { \n \"id\" : \"statistics-average-collector\", \n \"name\" : \"statistics-average-collector\", \n \"type\" : \"periodic\", \n \"period\" : 900, \n \"created\" : 1430810902.617003, \n \"command\" : \"require('org/arangodb/statistics').historianAverage();\", \n \"database\" : \"_system\" \n }, \n { \n \"id\" : \"statistics-gc\", \n \"name\" : \"statistics-gc\", \n \"type\" : \"periodic\", \n \"period\" : 450, \n \"created\" : 1430810902.617325, \n \"command\" : \"require('org/arangodb/statistics').garbageCollector();\", \n \"database\" : \"_system\" \n } \n]\n
shell> curl --dump - http://localhost:8529/_api/tasks/statistics-average-collector\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"statistics-average-collector\", \n \"name\" : \"statistics-average-collector\", \n \"type\" : \"periodic\", \n \"period\" : 900, \n \"created\" : 1430810902.617003, \n \"command\" : \"require('org/arangodb/statistics').historianAverage();\", \n \"database\" : \"_system\", \n \"error\" : false, \n \"code\" : 200 \n}\n
shell> curl --dump - http://localhost:8529/_api/tasks/non-existing-task\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 404, \n \"errorNum\" : 1852, \n \"errorMessage\" : \"task not found\" \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/tasks/ <<EOF\n{\"name\":\"SampleTask\",\"command\":\"(function(params) { require('internal').print(params); })(params)\",\"params\":{\"foo\":\"bar\",\"bar\":\"foo\"},\"period\":2}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"1244734517\", \n \"name\" : \"SampleTask\", \n \"type\" : \"periodic\", \n \"period\" : 2, \n \"created\" : 1430810913.379243, \n \"command\" : \"(function(params) { require('internal').print(params); })(params)\", \n \"database\" : \"_system\", \n \"error\" : false, \n \"code\" : 200 \n}\nshell> curl -X DELETE --dump - http://localhost:8529/_api/tasks/1244734517\n\n
shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/tasks/sampleTask <<EOF\n{\"id\":\"SampleTask\",\"name\":\"SampleTask\",\"command\":\"(function(params) { require('internal').print(params); })(params)\",\"params\":{\"foo\":\"bar\",\"bar\":\"foo\"},\"period\":2}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"sampleTask\", \n \"name\" : \"SampleTask\", \n \"type\" : \"periodic\", \n \"period\" : 2, \n \"created\" : 1430810913.387985, \n \"command\" : \"(function(params) { require('internal').print(params); })(params)\", \n \"database\" : \"_system\", \n \"error\" : false, \n \"code\" : 200 \n}\n
shell> curl -X DELETE --dump - http://localhost:8529/_api/tasks/NoTaskWithThatName\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 404, \n \"errorNum\" : 1852, \n \"errorMessage\" : \"task not found\" \n}\n
shell> curl -X DELETE --dump - http://localhost:8529/_api/tasks/SampleTask\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : false, \n \"code\" : 200 \n}\n