Crm · Work hours
Get work hours settings
Gets an organization's work hours settings using its organization ID. Returns the settings, including rules and reviewers, or null if work hours are not set up.
Permissions
Send an API key of the organization in the path, using the X-API-Key header.
Who may call it
- The caller must have access to the organization.
- The caller must have the
crmSettings.readpermission.
Request
Path parameters
-
organizationIdidrequired
curl --fail-with-body --silent --show-error --max-time 30 --globoff \
--request GET 'https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/crm/work-hours/settings' \
--header 'X-API-Key: YOUR_API_KEY'const response = await fetch("https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/crm/work-hours/settings", {
method: "GET",
headers: {
"X-API-Key": "YOUR_API_KEY"
},
redirect: 'error',
signal: AbortSignal.timeout(30_000),
});
if (!response.ok) throw new Error(`campai HTTP ${response.status}`);
const text = await response.text();
const result = text ? JSON.parse(text) : null;
console.log(JSON.stringify(result, null, 2));<?php
$context = stream_context_create(['http' => [
'method' => 'GET',
'header' => [
'X-API-Key: YOUR_API_KEY',
],
'timeout' => 30,
'follow_location' => 0,
'ignore_errors' => true,
]]);
$text = @file_get_contents('https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/crm/work-hours/settings', false, $context);
preg_match('/^HTTP\/\S+ (\d{3})/', $http_response_header[0] ?? '', $match);
$status = (int) ($match[1] ?? 0);
if ($text === false || $status < 200 || $status >= 300) {
throw new RuntimeException("campai HTTP $status (0 means no response)");
}
$result = $text === '' ? null : json_decode($text, true, 512, JSON_THROW_ON_ERROR);
echo json_encode($result, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR), PHP_EOL;
Response
200 Successful response
Content-Type: application/json
-
periodStartMonthinteger1–12
-
submissionDeadlineDaysinteger0–90
-
reminderDaysBeforeDeadlineinteger0–60
-
rulesobject[]at most 50 items
19 properties
-
_idid -
labelstring1–60 characters
-
activeboolean -
unitstringhoursshifts -
requirednumber0–999
-
conditionobjectnullable2 properties
-
operatorstringandor -
conditions(object (recursive) | object)[]at least 1 items
4 properties
-
leftobject | object of anyVariant 1: 1 property
-
variablestringat least 1 characters
Variant 2: 4 properties
-
sourceobject1 property
-
variablestringat least 1 characters
-
-
lookupobjectnullable1 property
-
variablestringat least 1 characters
-
-
arrayboolean -
selectobject (recursive)
Variant 3: 2 properties
-
funcstring33 values
concatifEmptylowercaseuppercasesubstringtrimabsceilfloorminmaxmodsumsubmuldivavgmedparseNumberformatNumberdateOnlydateTimedateOnlyPartdateTimePartagedateOnlyDifferencedateTimeDifferencesetDateOnlysetDateTimeaddDateOnlyaddDateTimeformatDateOnlyformatDateTime -
paramsobject (recursive)[]
Variant 4: 1 property
-
literalnumber[] | number
Variant 5: 3 properties
-
ifobject (recursive) -
thenobject (recursive) -
elseobject (recursive)
-
-
cmpFuncstring15 values
eqisSetltltegtgteincludescontainsstartsWithendsWithbeforebeforeAtafterafterAtisToday -
rightobject | object of anyVariant 1: 1 property
-
variablestringat least 1 characters
Variant 2: 4 properties
-
sourceobject1 property
-
variablestringat least 1 characters
-
-
lookupobjectnullable1 property
-
variablestringat least 1 characters
-
-
arrayboolean -
selectobject (recursive)
Variant 3: 2 properties
-
funcstring33 values
concatifEmptylowercaseuppercasesubstringtrimabsceilfloorminmaxmodsumsubmuldivavgmedparseNumberformatNumberdateOnlydateTimedateOnlyPartdateTimePartagedateOnlyDifferencedateTimeDifferencesetDateOnlysetDateTimeaddDateOnlyaddDateTimeformatDateOnlyformatDateTime -
paramsobject (recursive)[]
Variant 4: 1 property
-
literalnumber[] | number
Variant 5: 3 properties
-
ifobject (recursive) -
thenobject (recursive) -
elseobject (recursive)
-
-
negateboolean
-
-
-
holderstringcontactgroup -
groupTypeidnullable -
helpersstringmembersanyone -
proRatastringnonemonths -
feeintegernullableat most 999999
-
buyoutobjectnullable2 properties
-
amountintegerat most 9999999
-
untilDaysinteger0–365
-
-
accountintegernullable1–999999999
-
costCenter1numbernullable1–99999999
-
costCenter2numbernullable1–99999999
-
eventCategoriesobject[]at most 10 items
3 properties
-
namestring1–60 characters
-
nameNormalizedstring1–60 characters
-
bookingCategoryIdid
-
-
reviewerUserIdsstring[]at most 50 items · each at least 1 characters
-
legalBasisstringat most 300 characters
-
decidedAtstringnullable
-
-
reviewerUserIdsstring[]at most 50 items · each at least 1 characters
-
reviewerRulesobject[]at most 50 items
2 properties
-
conditionobject2 properties
-
operatorstringandor -
conditions(object (recursive) | object)[]at least 1 items
4 properties
-
leftobject | object of anyVariant 1: 1 property
-
variablestringat least 1 characters
Variant 2: 4 properties
-
sourceobject1 property
-
variablestringat least 1 characters
-
-
lookupobjectnullable1 property
-
variablestringat least 1 characters
-
-
arrayboolean -
selectobject (recursive)
Variant 3: 2 properties
-
funcstring33 values
concatifEmptylowercaseuppercasesubstringtrimabsceilfloorminmaxmodsumsubmuldivavgmedparseNumberformatNumberdateOnlydateTimedateOnlyPartdateTimePartagedateOnlyDifferencedateTimeDifferencesetDateOnlysetDateTimeaddDateOnlyaddDateTimeformatDateOnlyformatDateTime -
paramsobject (recursive)[]
Variant 4: 1 property
-
literalnumber[] | number
Variant 5: 3 properties
-
ifobject (recursive) -
thenobject (recursive) -
elseobject (recursive)
-
-
cmpFuncstring15 values
eqisSetltltegtgteincludescontainsstartsWithendsWithbeforebeforeAtafterafterAtisToday -
rightobject | object of anyVariant 1: 1 property
-
variablestringat least 1 characters
Variant 2: 4 properties
-
sourceobject1 property
-
variablestringat least 1 characters
-
-
lookupobjectnullable1 property
-
variablestringat least 1 characters
-
-
arrayboolean -
selectobject (recursive)
Variant 3: 2 properties
-
funcstring33 values
concatifEmptylowercaseuppercasesubstringtrimabsceilfloorminmaxmodsumsubmuldivavgmedparseNumberformatNumberdateOnlydateTimedateOnlyPartdateTimePartagedateOnlyDifferencedateTimeDifferencesetDateOnlysetDateTimeaddDateOnlyaddDateTimeformatDateOnlyformatDateTime -
paramsobject (recursive)[]
Variant 4: 1 property
-
literalnumber[] | number
Variant 5: 3 properties
-
ifobject (recursive) -
thenobject (recursive) -
elseobject (recursive)
-
-
negateboolean
-
-
-
reviewerUserIdsstring[]1–50 items · each at least 1 characters
-
-
defaultMandateidnullable -
sepaDirectDebitCashAccountidnullable -
sepaCreditTransferCashAccountidnullable
{
"periodStartMonth": 1,
"submissionDeadlineDays": 0,
"reminderDaysBeforeDeadline": 0,
"rules": [
{
"_id": "000000000000000000000001",
"label": "string",
"active": true,
"unit": "hours",
"required": 0,
"condition": {
"operator": "and",
"conditions": [
null
]
},
"holder": "contact",
"groupType": "000000000000000000000001",
"helpers": "members",
"proRata": "none",
"fee": 1,
"buyout": {
"amount": 1,
"untilDays": 0
},
"account": 1,
"costCenter1": 1,
"costCenter2": 1,
"eventCategories": [
{
"name": "string",
"nameNormalized": "string",
"bookingCategoryId": "000000000000000000000001"
}
],
"reviewerUserIds": [
"string"
],
"legalBasis": "string",
"decidedAt": "string"
}
],
"reviewerUserIds": [
"string"
],
"reviewerRules": [
{
"condition": {
"operator": "and",
"conditions": [
null
]
},
"reviewerUserIds": [
"string"
]
}
],
"defaultMandate": "000000000000000000000001",
"sepaDirectDebitCashAccount": "000000000000000000000001",
"sepaCreditTransferCashAccount": "000000000000000000000001"
}
Errors
No errors of its own are known for this endpoint.
Errors nearly every request can meet are listed under Errors.