API Documentation

A documentation for developer

Cron Job

POST Create cron job

HTTP Request

POST https://manage.runcloud.io/base-api/servers/<server.id>/cronjobs

Arguments

Parameters Required Description
jobName YES Name of the Cron Job
user YES Linux System User that will be running this job
command YES Full command of job to be running. You can use server._extra.cronJobs.vendor to prepend the job command before the actual script/command to be running
minute YES Crontab syntax for minute
hour YES Crontab syntax for hour
dayOfMonth YES Crontab syntax for the day of month
month YES Crontab syntax for month
dayOfWeek YES Crontab syntax for the day of week

Request

curl -X POST "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/cronjobs" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    --data '{
        "jobName": "this is my first job",
        "user": "root",
        "command": "/bin/bash /root/removesomething.sh",
        "minute": "*",
        "hour": "*/2",
        "dayOfMonth": "*",
        "month": "*",
        "dayOfWeek": "*"
    }'

Response

{
    "message": "Successfully added new cron job this is my first job.",
    "redirect": "\/servers\/yO4VAbX2BkNz\/cronjobs"
}

GET List jobs

List all cron jobs.

HTTP Request

GET https://manage.runcloud.io/base-api/servers/<server.id>/cronjobs

Arguments

Parameters Required Description
page NO Page number of the resources
search NO Searching string if you wanted to search from list of jobs

Request

curl -X GET "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/cronjobs?page=1" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"

Response

{
    "data": [
        {
            "id": "OE8oAdb2G4wn",
            "name": "this is my first job",
            "user": "root",
            "time": "* *\/2 * * *",
            "command": "\/bin\/bash \/root\/removesomething.sh",
            "_links": {
                "delete": {
                    "method": "delete",
                    "link": "\/api\/servers\/yO4VAbX2BkNz\/cronjobs\/OE8oAdb2G4wn"
                }
            }
        }
    ],
    "meta": {
        "pagination": {
            "total": 2,
            "count": 2,
            "per_page": 20,
            "current_page": 1,
            "total_pages": 1,
            "links": []
        }
    }
}

POST Rebuild jobs

Rebuild all cron jobs.

HTTP Request

POST https://manage.runcloud.io/base-api/servers/<server.id>/cronjobs/rebuild

Request

curl -X POST "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/cronjobs/rebuild" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"

Response

{
    "message": "Your cron job will be rebuilt shortly."
}

GET Job object

Get cron job.

HTTP Request

GET https://manage.runcloud.io/base-api/servers/<server.id>/cronjobs/<job.id>

Request

curl -X GET "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/cronjobs/OE8oAdb2G4wn" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"

Response

{
    "id": "OE8oAdb2G4wn",
    "name": "this is my first job",
    "user": "root",
    "time": "* *\/2 * * *",
    "command": "\/bin\/bash \/root\/removesomething.sh",
    "_links": {
        "delete": {
            "method": "delete",
            "link": "\/api\/servers\/yO4VAbX2BkNz\/cronjobs\/OE8oAdb2G4wn"
        }
    }
}

DELETE Delete job

Delete a cron job.

HTTP Request

DELETE https://manage.runcloud.io/base-api/servers/<server.id>/cronjobs/<job.id>

Request

curl -X DELETE "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/cronjobs/OE8oAdb2G4wn" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"

Response

{
    "message": "Successfully deleted cron job this is my first job."
}