Create cron job

POST /servers/{serverId}/cronjobs

Parameters
label requiredLabel of the Cron Job
username requiredLinux System User that will be running this job
command requiredFull command of job to be running/td>
minute requiredCrontab syntax for minute
hour requiredCrontab syntax for hour
dayOfMonth requiredCrontab syntax for the day of month
month requiredCrontab syntax for month
dayOfWeek requiredCrontab syntax for the day of week
HTTP Request
POST https://manage.runcloud.io/api/v2/servers/{serverId}/cronjobs
Request
curl --request POST \
  --url https://manage.runcloud.io/api/v2/servers/7/cronjobs \
  -u YOUR_API_KEY:YOUR_API_SECRET \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{
    "label": "my first job",
    "username": "root",
    "command": "/bin/bash /root/clearitem.sh",
    "minute": "*",
    "hour": "*/2",
    "dayOfMonth": "*",
    "month": "*",
    "dayOfWeek": "*"
}'
Response
{
    "id": 9,
    "label": "my first job",
    "username": "root",
    "time": "* */2 * * *",
    "command": "/bin/bash /root/clearitem.sh",
    "created_at": "2019-06-23 13:58:29"
}

List jobs

GET /servers/{serverId}/cronjobs

Query String Parameters
search optionalStringSearching string if you wanted to search from list of jobs
HTTP Request
GET https://manage.runcloud.io/api/v2/servers/{serverId}/cronjobs
Request
curl --request GET \
  --url https://manage.runcloud.io/api/v2/servers/7/cronjobs \
  -u YOUR_API_KEY:YOUR_API_SECRET \
  --header 'accept: application/json' \
  --header 'content-type: application/json'
Response
{
    "data": [
        {
            "id": 9,
            "label": "my first job",
            "username": "root",
            "time": "* */2 * * *",
            "command": "/bin/bash /root/clearitem.sh",
            "created_at": "2019-06-23 13:58:29"
        },
        {
            "id": 7,
            "label": "test",
            "username": "runcloud",
            "time": "* * * * *",
            "command": "/bin/bash kjhj",
            "created_at": "2019-05-14 18:43:33"
        }
    ],
    "meta": {
        "pagination": {
            "total": 2,
            "count": 2,
            "per_page": 15,
            "current_page": 1,
            "total_pages": 1,
            "links": {}
        }
    }
}

Job object

GET /servers/{serverId}/cronjobs/{jobId}

HTTP Request
GET https://manage.runcloud.io/api/v2/servers/{serverId}/cronjobs/{jobId}
Request
curl --request GET \
  --url https://manage.runcloud.io/api/v2/servers/7/cronjobs/9 \
  -u YOUR_API_KEY:YOUR_API_SECRET \
  --header 'accept: application/json' \
  --header 'content-type: application/json'
Response
{
    "id": 9,
    "label": "my first job",
    "username": "root",
    "time": "* */2 * * *",
    "command": "/bin/bash /root/clearitem.sh",
    "created_at": "2019-06-23 13:58:29"
}

Rebuild jobs

POST /servers/{serverId}/cronjobs/rebuild

HTTP Request
POST https://manage.runcloud.io/api/v2/servers/{serverId}/cronjobs/rebuild
Request
curl --request POST \
  --url https://manage.runcloud.io/api/v2/servers/7/cronjobs/rebuild \
  -u YOUR_API_KEY:YOUR_API_SECRET \
  --header 'accept: application/json' \
  --header 'content-type: application/json'
Response

Delete job

DELETE /servers/{serverId}/cronjobs/{jobId}

HTTP Request
DELETE https://manage.runcloud.io/api/v2/servers/{serverId}/cronjobs/{jobId}
Request
curl --request DELETE \
  --url https://manage.runcloud.io/api/v2/servers/7/cronjobs/9 \
  -u YOUR_API_KEY:YOUR_API_SECRET \
  --header 'accept: application/json' \
  --header 'content-type: application/json'
Response
{
    "id": 9,
    "label": "my first job",
    "username": "root",
    "time": "* */2 * * *",
    "command": "/bin/bash /root/clearitem.sh",
    "created_at": "2019-06-23 13:58:29"
}