{
"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 --data-binary @- --dump - http://localhost:8529/_api/tasks\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n[ \n { \n \"id\" : \"19146915\", \n \"name\" : \"user-defined task\", \n \"type\" : \"periodic\", \n \"period\" : 1, \n \"created\" : 1424684796.019833, \n \"command\" : \"(function () {\\n require('org/arangodb/foxx/queues/manager').manage();\\n })(params)\", \n \"database\" : \"_system\" \n }, \n { \n \"id\" : \"statistics-average-collector\", \n \"name\" : \"statistics-average-collector\", \n \"type\" : \"periodic\", \n \"period\" : 900, \n \"created\" : 1424684795.950814, \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\" : 1424684795.95123, \n \"command\" : \"require('org/arangodb/statistics').garbageCollector();\", \n \"database\" : \"_system\" \n }, \n { \n \"id\" : \"statistics-collector\", \n \"name\" : \"statistics-collector\", \n \"type\" : \"periodic\", \n \"period\" : 10, \n \"created\" : 1424684795.950749, \n \"command\" : \"require('org/arangodb/statistics').historian();\", \n \"database\" : \"_system\" \n } \n]\n
shell> curl --data-binary @- --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\" : 1424684795.950814, \n \"command\" : \"require('org/arangodb/statistics').historianAverage();\", \n \"database\" : \"_system\", \n \"error\" : false, \n \"code\" : 200 \n}\n
shell> curl --data-binary @- --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/\n{\"name\":\"SampleTask\",\"command\":\"(function(params) { require('internal').print(params); })(params)\",\"params\":{\"foo\":\"bar\",\"bar\":\"foo\"},\"period\":2}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"1299720355\", \n \"name\" : \"SampleTask\", \n \"type\" : \"periodic\", \n \"period\" : 2, \n \"created\" : 1424684828.135708, \n \"command\" : \"(function(params) { require('internal').print(params); })(params)\", \n \"database\" : \"_system\", \n \"error\" : false, \n \"code\" : 200 \n}\nshell> curl -X DELETE --data-binary @- --dump - http://localhost:8529/_api/tasks/1299720355\n\n
shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/tasks/sampleTask\n{\"id\":\"SampleTask\",\"name\":\"SampleTask\",\"command\":\"(function(params) { require('internal').print(params); })(params)\",\"params\":{\"foo\":\"bar\",\"bar\":\"foo\"},\"period\":2}\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\" : 1424684828.153775, \n \"command\" : \"(function(params) { require('internal').print(params); })(params)\", \n \"database\" : \"_system\", \n \"error\" : false, \n \"code\" : 200 \n}\n
shell> curl -X DELETE --data-binary @- --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 --data-binary @- --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