Create Cron Job
curl --request POST \
--url https://api.opensink.com/api/v1/cron-jobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"schedule_interval_minutes": 2,
"request_url": "<string>",
"schedule_start_minute": 29,
"request_headers": {},
"request_body": {},
"is_enabled": true
}
'import requests
url = "https://api.opensink.com/api/v1/cron-jobs"
payload = {
"name": "<string>",
"schedule_interval_minutes": 2,
"request_url": "<string>",
"schedule_start_minute": 29,
"request_headers": {},
"request_body": {},
"is_enabled": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
schedule_interval_minutes: 2,
request_url: '<string>',
schedule_start_minute: 29,
request_headers: {},
request_body: {},
is_enabled: true
})
};
fetch('https://api.opensink.com/api/v1/cron-jobs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.opensink.com/api/v1/cron-jobs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'schedule_interval_minutes' => 2,
'request_url' => '<string>',
'schedule_start_minute' => 29,
'request_headers' => [
],
'request_body' => [
],
'is_enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.opensink.com/api/v1/cron-jobs"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"schedule_interval_minutes\": 2,\n \"request_url\": \"<string>\",\n \"schedule_start_minute\": 29,\n \"request_headers\": {},\n \"request_body\": {},\n \"is_enabled\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.opensink.com/api/v1/cron-jobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"schedule_interval_minutes\": 2,\n \"request_url\": \"<string>\",\n \"schedule_start_minute\": 29,\n \"request_headers\": {},\n \"request_body\": {},\n \"is_enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opensink.com/api/v1/cron-jobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"schedule_interval_minutes\": 2,\n \"request_url\": \"<string>\",\n \"schedule_start_minute\": 29,\n \"request_headers\": {},\n \"request_body\": {},\n \"is_enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"schedule_interval_minutes": 2,
"schedule_start_minute": 29,
"request_url": "<string>",
"request_method": "GET",
"request_headers": {},
"request_body": {},
"runs_count": 123,
"success_run_count": 123,
"failure_run_count": 123,
"last_run_at": "2023-11-07T05:31:56Z",
"next_run_at": "2023-11-07T05:31:56Z",
"is_enabled": true,
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"owner_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"schedule_interval_minutes": 2,
"schedule_start_minute": 29,
"request_url": "<string>",
"request_method": "GET",
"request_headers": {},
"request_body": {},
"runs_count": 123,
"success_run_count": 123,
"failure_run_count": 123,
"last_run_at": "2023-11-07T05:31:56Z",
"next_run_at": "2023-11-07T05:31:56Z",
"is_enabled": true,
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"owner_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "Bad request"
}{
"error": "Unauthorized"
}{
"error": "Insufficient permissions"
}Cron Job
Create Cron Job
Create a new cron job
Required scope: cron_jobs:write, cron_jobs:all, or all:all
POST
/
api
/
v1
/
cron-jobs
Create Cron Job
curl --request POST \
--url https://api.opensink.com/api/v1/cron-jobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"schedule_interval_minutes": 2,
"request_url": "<string>",
"schedule_start_minute": 29,
"request_headers": {},
"request_body": {},
"is_enabled": true
}
'import requests
url = "https://api.opensink.com/api/v1/cron-jobs"
payload = {
"name": "<string>",
"schedule_interval_minutes": 2,
"request_url": "<string>",
"schedule_start_minute": 29,
"request_headers": {},
"request_body": {},
"is_enabled": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
schedule_interval_minutes: 2,
request_url: '<string>',
schedule_start_minute: 29,
request_headers: {},
request_body: {},
is_enabled: true
})
};
fetch('https://api.opensink.com/api/v1/cron-jobs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.opensink.com/api/v1/cron-jobs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'schedule_interval_minutes' => 2,
'request_url' => '<string>',
'schedule_start_minute' => 29,
'request_headers' => [
],
'request_body' => [
],
'is_enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.opensink.com/api/v1/cron-jobs"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"schedule_interval_minutes\": 2,\n \"request_url\": \"<string>\",\n \"schedule_start_minute\": 29,\n \"request_headers\": {},\n \"request_body\": {},\n \"is_enabled\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.opensink.com/api/v1/cron-jobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"schedule_interval_minutes\": 2,\n \"request_url\": \"<string>\",\n \"schedule_start_minute\": 29,\n \"request_headers\": {},\n \"request_body\": {},\n \"is_enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opensink.com/api/v1/cron-jobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"schedule_interval_minutes\": 2,\n \"request_url\": \"<string>\",\n \"schedule_start_minute\": 29,\n \"request_headers\": {},\n \"request_body\": {},\n \"is_enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"schedule_interval_minutes": 2,
"schedule_start_minute": 29,
"request_url": "<string>",
"request_method": "GET",
"request_headers": {},
"request_body": {},
"runs_count": 123,
"success_run_count": 123,
"failure_run_count": 123,
"last_run_at": "2023-11-07T05:31:56Z",
"next_run_at": "2023-11-07T05:31:56Z",
"is_enabled": true,
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"owner_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"schedule_interval_minutes": 2,
"schedule_start_minute": 29,
"request_url": "<string>",
"request_method": "GET",
"request_headers": {},
"request_body": {},
"runs_count": 123,
"success_run_count": 123,
"failure_run_count": 123,
"last_run_at": "2023-11-07T05:31:56Z",
"next_run_at": "2023-11-07T05:31:56Z",
"is_enabled": true,
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"owner_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "Bad request"
}{
"error": "Unauthorized"
}{
"error": "Insufficient permissions"
}Authorizations
API key authentication
Body
application/json
Job name
Required string length:
1 - 255Interval in minutes between runs
Required range:
x >= 1URL to call
Starting minute for the schedule
Required range:
0 <= x <= 59HTTP method
Available options:
GET, POST, PUT, DELETE HTTP headers
Request body for POST/PUT
Whether the job is enabled
Response
A scheduled job that makes HTTP requests at specified intervals
A scheduled job that makes HTTP requests at specified intervals
Unique identifier
Job name
Required string length:
1 - 255Interval in minutes between runs
Required range:
x >= 1Starting minute for the schedule
Required range:
0 <= x <= 59URL to call
HTTP method
Available options:
GET, POST, PUT, DELETE HTTP headers
Request body for POST/PUT
Total number of runs
Number of successful runs
Number of failed runs
Last run timestamp
Next scheduled run
Whether the job is enabled
Workspace ID
Owner user ID
Creation timestamp
Last update timestamp

