Deprecation Notice - RunCloud API Beta is deprecated effective 31 May 2019. New API will be released and it's not backward compatible.

Cron Job

Create cron job

Arguments
jobNamerequiredName of the Cron Job
userrequiredLinux System User that will be running this job
commandrequiredFull 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
minuterequiredCrontab syntax for minute
hourrequiredCrontab syntax for hour
dayOfMonthrequiredCrontab syntax for the day of month
monthrequiredCrontab syntax for month
dayOfWeekrequiredCrontab syntax for the day of week

POST /servers/<server.id>/cronjobs

HTTP Request
POST https://manage.runcloud.io/base-api/servers/<server.id>/cronjobs
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"
}

List jobs

Arguments
pageoptionalPage number of the resources
searchoptionalSearching string if you wanted to search from list of jobs

GET /servers/<server.id>/cronjobs

HTTP Request
GET https://manage.runcloud.io/base-api/servers/<server.id>/cronjobs
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": []
		}
	}
}

Rebuild jobs

GET /servers/<server.id>/cronjobs/rebuild

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."
}

Job object

GET /servers/<server.id>/cronjobs/id

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 job

DELETE /servers/<server.id>/cronjobs/id

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."
}