Dkron REST API (1-oas3)
Download OpenAPI specification:Download
You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port 8080
for API requests. All examples in this section assume that you've found a running leader at localhost:8080
.
Dkron implements a RESTful JSON API over HTTP to communicate with software clients. Dkron listens in port 8080
by default. All examples in this section assume that you're using the default port.
Default API responses are unformatted JSON add the pretty=true
param to format the response.
Response samples
- 200
{- "Name": "dkron1",
- "Addr": "192.168.1.137",
- "Port": 8946,
- "Tags": {
- "rpc_addr": "192.168.1.137:6868",
- "server": "true",
- "version"": "1.0.0"
}, - "Status": 1,
- "ProtocolMin": 5,
- "ProtocolMax": 2,
- "ProtocolCur": 2,
- "DelegateMin": 0,
- "DelegateMax": 5,
- "DelegateCur": 4
}
Response samples
- 200
[- {
- "Name": "dkron1",
- "Addr": "192.168.1.137",
- "Port": 8946,
- "Tags": {
- "rpc_addr": "192.168.1.137:6868",
- "server": "true",
- "version"": "1.0.0"
}, - "Status": 1,
- "ProtocolMin": 5,
- "ProtocolMax": 2,
- "ProtocolCur": 2,
- "DelegateMin": 0,
- "DelegateMax": 5,
- "DelegateCur": 4
}
]
getJobs
List jobs.
Authorizations:
query Parameters
metadata | Array of strings Filter jobs by metadata |
_sort | string Sorting field |
_order | string Sort order (ASC/DESC) |
q | string Filter query text |
_start | integer Start index |
_end | integer End index |
Responses
Response samples
- 200
[- {
- "name": "job1",
- "displayname": "string",
- "schedule": "@every 10s",
- "timezone": "Europe/Berlin",
- "owner": "Platform Team",
- "success_count": 0,
- "error_count": 0,
- "last_success": "2019-08-24T14:15:22Z",
- "last_error": "2019-08-24T14:15:22Z",
- "disabled": true,
- "tags": {
- "server": "true"
}, - "metadata": {
- "office": "Barcelona"
}, - "retries": 2,
- "parent_job": "parent_job",
- "dependent_jobs": "dependent_job",
- "processors": {
- "files": {
- "forward": true
}
}, - "concurrency": "allow",
- "executor": "shell",
- "executor_config": {
- "command": "echo 'Hello from Dkron'"
}, - "status": "success",
- "next": "2019-08-24T14:15:22Z"
}
]
createOrUpdateJob
Create or updates a new job.
Authorizations:
query Parameters
runoncreate | boolean If present, regardless of any value, causes the job to be run immediately after being succesfully created or updated. |
Request Body schema: application/jsonrequired
Updated job object
name required | string Name for the job. Use only lower case letters (unicode), digits, underscore and dash. |
displayname | string Nice name for the job. Optional. |
schedule required | string Cron expression for the job. |
timezone | string Timezone where the job will be executed. By default and when field is set to empty string, the job will run in local time. |
owner | string Owner of the job |
owner_email | string Email of the owner |
disabled | boolean Disabled state of the job |
object Target nodes tags of this job | |
object Extra metadata tags for this job | |
retries | integer Number of times to retry a failed job execution |
parent_job | string The name/id of the job that will trigger the execution of this job |
object (processors) Processor plugins used to process executions results of this job | |
concurrency | string Concurrency policy for the job allow/forbid |
executor | string Executor plugin used to run the job |
object Executor plugin parameters |
Responses
Request samples
- Payload
{- "name": "job1",
- "displayname": "string",
- "schedule": "@every 10s",
- "timezone": "Europe/Berlin",
- "owner": "Platform Team",
- "disabled": true,
- "tags": {
- "server": "true"
}, - "metadata": {
- "office": "Barcelona"
}, - "retries": 2,
- "parent_job": "parent_job",
- "processors": {
- "files": {
- "forward": true
}
}, - "concurrency": "allow",
- "executor": "shell",
- "executor_config": {
- "command": "echo 'Hello from Dkron'"
}
}
Response samples
- 201
{- "name": "job1",
- "displayname": "string",
- "schedule": "@every 10s",
- "timezone": "Europe/Berlin",
- "owner": "Platform Team",
- "success_count": 0,
- "error_count": 0,
- "last_success": "2019-08-24T14:15:22Z",
- "last_error": "2019-08-24T14:15:22Z",
- "disabled": true,
- "tags": {
- "server": "true"
}, - "metadata": {
- "office": "Barcelona"
}, - "retries": 2,
- "parent_job": "parent_job",
- "dependent_jobs": "dependent_job",
- "processors": {
- "files": {
- "forward": true
}
}, - "concurrency": "allow",
- "executor": "shell",
- "executor_config": {
- "command": "echo 'Hello from Dkron'"
}, - "status": "success",
- "next": "2019-08-24T14:15:22Z"
}
showJobByName
Show a job.
Authorizations:
path Parameters
job_name required | string The job that needs to be fetched. |
Responses
Response samples
- 200
{- "name": "job1",
- "displayname": "string",
- "schedule": "@every 10s",
- "timezone": "Europe/Berlin",
- "owner": "Platform Team",
- "success_count": 0,
- "error_count": 0,
- "last_success": "2019-08-24T14:15:22Z",
- "last_error": "2019-08-24T14:15:22Z",
- "disabled": true,
- "tags": {
- "server": "true"
}, - "metadata": {
- "office": "Barcelona"
}, - "retries": 2,
- "parent_job": "parent_job",
- "dependent_jobs": "dependent_job",
- "processors": {
- "files": {
- "forward": true
}
}, - "concurrency": "allow",
- "executor": "shell",
- "executor_config": {
- "command": "echo 'Hello from Dkron'"
}, - "status": "success",
- "next": "2019-08-24T14:15:22Z"
}
runJob
Executes a job.
Authorizations:
path Parameters
job_name required | string The job that needs to be run. |
Responses
Response samples
- 202
{- "name": "job1",
- "displayname": "string",
- "schedule": "@every 10s",
- "timezone": "Europe/Berlin",
- "owner": "Platform Team",
- "success_count": 0,
- "error_count": 0,
- "last_success": "2019-08-24T14:15:22Z",
- "last_error": "2019-08-24T14:15:22Z",
- "disabled": true,
- "tags": {
- "server": "true"
}, - "metadata": {
- "office": "Barcelona"
}, - "retries": 2,
- "parent_job": "parent_job",
- "dependent_jobs": "dependent_job",
- "processors": {
- "files": {
- "forward": true
}
}, - "concurrency": "allow",
- "executor": "shell",
- "executor_config": {
- "command": "echo 'Hello from Dkron'"
}, - "status": "success",
- "next": "2019-08-24T14:15:22Z"
}
deleteJob
Delete a job.
Authorizations:
path Parameters
job_name required | string The job that needs to be deleted. |
Responses
Response samples
- 200
{- "name": "job1",
- "displayname": "string",
- "schedule": "@every 10s",
- "timezone": "Europe/Berlin",
- "owner": "Platform Team",
- "success_count": 0,
- "error_count": 0,
- "last_success": "2019-08-24T14:15:22Z",
- "last_error": "2019-08-24T14:15:22Z",
- "disabled": true,
- "tags": {
- "server": "true"
}, - "metadata": {
- "office": "Barcelona"
}, - "retries": 2,
- "parent_job": "parent_job",
- "dependent_jobs": "dependent_job",
- "processors": {
- "files": {
- "forward": true
}
}, - "concurrency": "allow",
- "executor": "shell",
- "executor_config": {
- "command": "echo 'Hello from Dkron'"
}, - "status": "success",
- "next": "2019-08-24T14:15:22Z"
}
toggleJob
Toggle a job.
Authorizations:
path Parameters
job_name required | string The job that needs to be toggled. |
Responses
Response samples
- 200
{- "name": "job1",
- "displayname": "string",
- "schedule": "@every 10s",
- "timezone": "Europe/Berlin",
- "owner": "Platform Team",
- "success_count": 0,
- "error_count": 0,
- "last_success": "2019-08-24T14:15:22Z",
- "last_error": "2019-08-24T14:15:22Z",
- "disabled": true,
- "tags": {
- "server": "true"
}, - "metadata": {
- "office": "Barcelona"
}, - "retries": 2,
- "parent_job": "parent_job",
- "dependent_jobs": "dependent_job",
- "processors": {
- "files": {
- "forward": true
}
}, - "concurrency": "allow",
- "executor": "shell",
- "executor_config": {
- "command": "echo 'Hello from Dkron'"
}, - "status": "success",
- "next": "2019-08-24T14:15:22Z"
}
Response samples
- 200
[- {
- "Name": "dkron1",
- "Addr": "192.168.1.137",
- "Port": 8946,
- "Tags": {
- "rpc_addr": "192.168.1.137:6868",
- "server": "true",
- "version"": "1.0.0"
}, - "Status": 1,
- "ProtocolMin": 5,
- "ProtocolMax": 2,
- "ProtocolCur": 2,
- "DelegateMin": 0,
- "DelegateMax": 5,
- "DelegateCur": 4
}
]
listExecutionsByJob
List executions.
Authorizations:
path Parameters
job_name required | string The job that owns the executions to be fetched. |
Responses
Response samples
- 200
[- {
- "job_name": "job_1",
- "started_at": "2019-08-24T14:15:22Z",
- "finished_at": "2019-08-24T14:15:22Z",
- "success": true,
- "output": "Hello from Dkron",
- "node_name": "dkron1"
}
]
showExecutionByID
Show execution.
Authorizations:
path Parameters
job_name required | string The job that owns the execution to be fetched. |
execution required | string The executions to be fetched. |
Responses
Response samples
- 200
{- "job_name": "job_1",
- "started_at": "2019-08-24T14:15:22Z",
- "finished_at": "2019-08-24T14:15:22Z",
- "success": true,
- "output": "Hello from Dkron",
- "node_name": "dkron1"
}