curl --request POST \
--url https://{organization}.rescueconsole.com/api/shifts/policies \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rule_key": "cancellation_notice_hours",
"value": 48,
"scope": "tenant",
"notes": "Two days to find cover."
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
rule_key: 'cancellation_notice_hours',
value: 48,
scope: 'tenant',
notes: 'Two days to find cover.'
})
};
fetch('https://{organization}.rescueconsole.com/api/shifts/policies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{organization}.rescueconsole.com/api/shifts/policies"
payload = {
"rule_key": "cancellation_notice_hours",
"value": 48,
"scope": "tenant",
"notes": "Two days to find cover."
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"scope": "tenant",
"rule_key": "max_centihours_per_day",
"value": 1,
"is_enabled": true,
"describes": "<string>",
"role_id": "<string>",
"location_unit_id": "<string>",
"notes": "<string>"
}{
"id": "<string>",
"scope": "tenant",
"rule_key": "max_centihours_per_day",
"value": 1,
"is_enabled": true,
"describes": "<string>",
"role_id": "<string>",
"location_unit_id": "<string>",
"notes": "<string>"
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}Set a shift policy
Sets a rule. There is one rule of each kind for each target, so sending a rule that already exists for the same scope, role and location changes it (200) rather than adding another (201). The most specific rule of each kind wins: a role rule over a location rule over one for your whole organization. Rules apply to every sign-up and cancellation, whoever makes it. Needs write on Shifts.
A coordinator’s: needs write on Shifts AND read on People. A key without read on People is refused (403) with “Only a coordinator can do this: it needs permission to see People.”
curl --request POST \
--url https://{organization}.rescueconsole.com/api/shifts/policies \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rule_key": "cancellation_notice_hours",
"value": 48,
"scope": "tenant",
"notes": "Two days to find cover."
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
rule_key: 'cancellation_notice_hours',
value: 48,
scope: 'tenant',
notes: 'Two days to find cover.'
})
};
fetch('https://{organization}.rescueconsole.com/api/shifts/policies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{organization}.rescueconsole.com/api/shifts/policies"
payload = {
"rule_key": "cancellation_notice_hours",
"value": 48,
"scope": "tenant",
"notes": "Two days to find cover."
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"scope": "tenant",
"rule_key": "max_centihours_per_day",
"value": 1,
"is_enabled": true,
"describes": "<string>",
"role_id": "<string>",
"location_unit_id": "<string>",
"notes": "<string>"
}{
"id": "<string>",
"scope": "tenant",
"rule_key": "max_centihours_per_day",
"value": 1,
"is_enabled": true,
"describes": "<string>",
"role_id": "<string>",
"location_unit_id": "<string>",
"notes": "<string>"
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}Authorizations
An API key from Settings, API keys. It starts with rc_live_.
Body
max_centihours_per_day: the most hours one person may sign up for in a day, in hundredths of an hour (250 is two and a half hours). max_centihours_per_week: the same for a week, Monday to Sunday. max_bookings_per_day: the most sign-ups one person may have in a day. booking_horizon_days: how many days ahead sign-ups open. booking_cutoff_hours: sign-ups close this many hours before the start. cancellation_notice_hours: giving up a sign-up less than this many hours before the start needs a coordinator's answer.
max_centihours_per_day, max_centihours_per_week, max_bookings_per_day, booking_horizon_days, booking_cutoff_hours, cancellation_notice_hours A whole number in the rule's unit.
x >= 0tenant applies to your whole organization.
tenant, role, location Required for a role rule, and refused for any other.
Required for a location rule, and refused for any other.
Response
The rule, changed.
tenant: your whole organization. role: one role. location: one location.
tenant, role, location max_centihours_per_day: the most hours one person may sign up for in a day, in hundredths of an hour (250 is two and a half hours). max_centihours_per_week: the same for a week, Monday to Sunday. max_bookings_per_day: the most sign-ups one person may have in a day. booking_horizon_days: how many days ahead sign-ups open. booking_cutoff_hours: sign-ups close this many hours before the start. cancellation_notice_hours: giving up a sign-up less than this many hours before the start needs a coordinator's answer.
max_centihours_per_day, max_centihours_per_week, max_bookings_per_day, booking_horizon_days, booking_cutoff_hours, cancellation_notice_hours A whole number in the rule's unit.
x >= 0The rule in words, such as "2.5 hours in one day".