Set run window
curl --request PUT \
--url https://api.cloudcruise.com/workflows/{workflow_id}/run-window \
--header 'Content-Type: application/json' \
--header 'cc-key: <api-key>' \
--data '
{
"time_zone": "America/Chicago",
"regular_hours": [
{
"active_start_time": {
"hours": 11,
"minutes": 29
},
"active_end_time": {
"hours": 11,
"minutes": 29
}
}
],
"special_hours": [
{
"active": true,
"label": "Thanksgiving",
"recurrence": "FREQ=MONTHLY;BYDAY=1SA"
}
]
}
'import requests
url = "https://api.cloudcruise.com/workflows/{workflow_id}/run-window"
payload = {
"time_zone": "America/Chicago",
"regular_hours": [
{
"active_start_time": {
"hours": 11,
"minutes": 29
},
"active_end_time": {
"hours": 11,
"minutes": 29
}
}
],
"special_hours": [
{
"active": True,
"label": "Thanksgiving",
"recurrence": "FREQ=MONTHLY;BYDAY=1SA"
}
]
}
headers = {
"cc-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'cc-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
time_zone: 'America/Chicago',
regular_hours: [
{
active_start_time: {hours: 11, minutes: 29},
active_end_time: {hours: 11, minutes: 29}
}
],
special_hours: [{active: true, label: 'Thanksgiving', recurrence: 'FREQ=MONTHLY;BYDAY=1SA'}]
})
};
fetch('https://api.cloudcruise.com/workflows/{workflow_id}/run-window', 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.cloudcruise.com/workflows/{workflow_id}/run-window",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'time_zone' => 'America/Chicago',
'regular_hours' => [
[
'active_start_time' => [
'hours' => 11,
'minutes' => 29
],
'active_end_time' => [
'hours' => 11,
'minutes' => 29
]
]
],
'special_hours' => [
[
'active' => true,
'label' => 'Thanksgiving',
'recurrence' => 'FREQ=MONTHLY;BYDAY=1SA'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"cc-key: <api-key>"
],
]);
$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.cloudcruise.com/workflows/{workflow_id}/run-window"
payload := strings.NewReader("{\n \"time_zone\": \"America/Chicago\",\n \"regular_hours\": [\n {\n \"active_start_time\": {\n \"hours\": 11,\n \"minutes\": 29\n },\n \"active_end_time\": {\n \"hours\": 11,\n \"minutes\": 29\n }\n }\n ],\n \"special_hours\": [\n {\n \"active\": true,\n \"label\": \"Thanksgiving\",\n \"recurrence\": \"FREQ=MONTHLY;BYDAY=1SA\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("cc-key", "<api-key>")
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.put("https://api.cloudcruise.com/workflows/{workflow_id}/run-window")
.header("cc-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"time_zone\": \"America/Chicago\",\n \"regular_hours\": [\n {\n \"active_start_time\": {\n \"hours\": 11,\n \"minutes\": 29\n },\n \"active_end_time\": {\n \"hours\": 11,\n \"minutes\": 29\n }\n }\n ],\n \"special_hours\": [\n {\n \"active\": true,\n \"label\": \"Thanksgiving\",\n \"recurrence\": \"FREQ=MONTHLY;BYDAY=1SA\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudcruise.com/workflows/{workflow_id}/run-window")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["cc-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"time_zone\": \"America/Chicago\",\n \"regular_hours\": [\n {\n \"active_start_time\": {\n \"hours\": 11,\n \"minutes\": 29\n },\n \"active_end_time\": {\n \"hours\": 11,\n \"minutes\": 29\n }\n }\n ],\n \"special_hours\": [\n {\n \"active\": true,\n \"label\": \"Thanksgiving\",\n \"recurrence\": \"FREQ=MONTHLY;BYDAY=1SA\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"run_window": {
"time_zone": "America/Chicago",
"regular_hours": [
{
"active_start_day": "MONDAY",
"active_start_time": {
"hours": 11,
"minutes": 29
},
"active_end_day": "MONDAY",
"active_end_time": {
"hours": 11,
"minutes": 29
}
}
],
"special_hours": [
{
"active": true,
"label": "Thanksgiving",
"start_date": {
"year": 123,
"month": 6,
"day": 16
},
"end_date": {
"year": 123,
"month": 6,
"day": 16
},
"recurrence": "FREQ=MONTHLY;BYDAY=1SA",
"recurrence_start": {
"year": 123,
"month": 6,
"day": 16
},
"active_start_time": {
"hours": 11,
"minutes": 29
},
"active_end_time": {
"hours": 11,
"minutes": 29
}
}
]
},
"state": {
"open": true,
"nextOpenAt": "2023-11-07T05:31:56Z"
},
"warnings": [
{
"path": "special_hours[0].recurrence_start",
"message": "<string>"
}
]
}{
"statusCode": 400,
"error": "InvalidRunWindow",
"message": "The run window is invalid",
"errors": [
{
"path": "special_hours[0].recurrence_start",
"message": "<string>"
}
]
}Workflow API
Set run window
Sets the workflow’s run window, replacing any existing one. Queued runs outside the new window are held, and held runs inside it are released, right away. This does not create a workflow version.
Requires the Owner or Member workspace role.
An invalid window returns 400 with error: "InvalidRunWindow" and an errors array listing each problem with its path. A valid window may still return warnings, for example when recurrence_start does not match its recurrence rule.
See Run Window.
PUT
/
workflows
/
{workflow_id}
/
run-window
Set run window
curl --request PUT \
--url https://api.cloudcruise.com/workflows/{workflow_id}/run-window \
--header 'Content-Type: application/json' \
--header 'cc-key: <api-key>' \
--data '
{
"time_zone": "America/Chicago",
"regular_hours": [
{
"active_start_time": {
"hours": 11,
"minutes": 29
},
"active_end_time": {
"hours": 11,
"minutes": 29
}
}
],
"special_hours": [
{
"active": true,
"label": "Thanksgiving",
"recurrence": "FREQ=MONTHLY;BYDAY=1SA"
}
]
}
'import requests
url = "https://api.cloudcruise.com/workflows/{workflow_id}/run-window"
payload = {
"time_zone": "America/Chicago",
"regular_hours": [
{
"active_start_time": {
"hours": 11,
"minutes": 29
},
"active_end_time": {
"hours": 11,
"minutes": 29
}
}
],
"special_hours": [
{
"active": True,
"label": "Thanksgiving",
"recurrence": "FREQ=MONTHLY;BYDAY=1SA"
}
]
}
headers = {
"cc-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'cc-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
time_zone: 'America/Chicago',
regular_hours: [
{
active_start_time: {hours: 11, minutes: 29},
active_end_time: {hours: 11, minutes: 29}
}
],
special_hours: [{active: true, label: 'Thanksgiving', recurrence: 'FREQ=MONTHLY;BYDAY=1SA'}]
})
};
fetch('https://api.cloudcruise.com/workflows/{workflow_id}/run-window', 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.cloudcruise.com/workflows/{workflow_id}/run-window",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'time_zone' => 'America/Chicago',
'regular_hours' => [
[
'active_start_time' => [
'hours' => 11,
'minutes' => 29
],
'active_end_time' => [
'hours' => 11,
'minutes' => 29
]
]
],
'special_hours' => [
[
'active' => true,
'label' => 'Thanksgiving',
'recurrence' => 'FREQ=MONTHLY;BYDAY=1SA'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"cc-key: <api-key>"
],
]);
$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.cloudcruise.com/workflows/{workflow_id}/run-window"
payload := strings.NewReader("{\n \"time_zone\": \"America/Chicago\",\n \"regular_hours\": [\n {\n \"active_start_time\": {\n \"hours\": 11,\n \"minutes\": 29\n },\n \"active_end_time\": {\n \"hours\": 11,\n \"minutes\": 29\n }\n }\n ],\n \"special_hours\": [\n {\n \"active\": true,\n \"label\": \"Thanksgiving\",\n \"recurrence\": \"FREQ=MONTHLY;BYDAY=1SA\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("cc-key", "<api-key>")
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.put("https://api.cloudcruise.com/workflows/{workflow_id}/run-window")
.header("cc-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"time_zone\": \"America/Chicago\",\n \"regular_hours\": [\n {\n \"active_start_time\": {\n \"hours\": 11,\n \"minutes\": 29\n },\n \"active_end_time\": {\n \"hours\": 11,\n \"minutes\": 29\n }\n }\n ],\n \"special_hours\": [\n {\n \"active\": true,\n \"label\": \"Thanksgiving\",\n \"recurrence\": \"FREQ=MONTHLY;BYDAY=1SA\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudcruise.com/workflows/{workflow_id}/run-window")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["cc-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"time_zone\": \"America/Chicago\",\n \"regular_hours\": [\n {\n \"active_start_time\": {\n \"hours\": 11,\n \"minutes\": 29\n },\n \"active_end_time\": {\n \"hours\": 11,\n \"minutes\": 29\n }\n }\n ],\n \"special_hours\": [\n {\n \"active\": true,\n \"label\": \"Thanksgiving\",\n \"recurrence\": \"FREQ=MONTHLY;BYDAY=1SA\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"run_window": {
"time_zone": "America/Chicago",
"regular_hours": [
{
"active_start_day": "MONDAY",
"active_start_time": {
"hours": 11,
"minutes": 29
},
"active_end_day": "MONDAY",
"active_end_time": {
"hours": 11,
"minutes": 29
}
}
],
"special_hours": [
{
"active": true,
"label": "Thanksgiving",
"start_date": {
"year": 123,
"month": 6,
"day": 16
},
"end_date": {
"year": 123,
"month": 6,
"day": 16
},
"recurrence": "FREQ=MONTHLY;BYDAY=1SA",
"recurrence_start": {
"year": 123,
"month": 6,
"day": 16
},
"active_start_time": {
"hours": 11,
"minutes": 29
},
"active_end_time": {
"hours": 11,
"minutes": 29
}
}
]
},
"state": {
"open": true,
"nextOpenAt": "2023-11-07T05:31:56Z"
},
"warnings": [
{
"path": "special_hours[0].recurrence_start",
"message": "<string>"
}
]
}{
"statusCode": 400,
"error": "InvalidRunWindow",
"message": "The run window is invalid",
"errors": [
{
"path": "special_hours[0].recurrence_start",
"message": "<string>"
}
]
}Authorizations
Body
application/json
A run window. For any date, dated special hours win over recurring special hours, which win over regular hours. Needs at least one regular period or one active special entry.
Response
The stored run window, whether it is open now, and any warnings
Was this page helpful?

