Crm · Contacts · Statistics
Get member development
Returns the active members today and at the start of a period, their entries and exits in the period and in the period of the same length right before it, the active members, entries and exits per month, the active members per age group and department today and at the end of each month, the active members today in the departments nested in each department, and the next entries, exits, birthdays and anniversaries. Departments are null without read access to them
Permissions
Send an API key of the organization in the path, using the X-API-Key header.
Permission checks in detail
Required permissions
mandate.readcontact:member.read
Also checked, depending on the request and the records it touches
department.read
Request
Path parameters
-
organizationIdidrequired -
mandateIdidrequired
Query parameters
-
fromDatestringrequired -
toDatestringrequired
curl --fail-with-body --silent --show-error --max-time 30 --globoff \
--request GET 'https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/YOUR_MANDATE_ID/crm/contacts/statistics/memberDevelopment' \
--header 'X-API-Key: YOUR_API_KEY'const response = await fetch("https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/YOUR_MANDATE_ID/crm/contacts/statistics/memberDevelopment", {
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/YOUR_MANDATE_ID/crm/contacts/statistics/memberDevelopment', 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
-
summaryobject6 properties
-
activeintegerat least 0
-
activeAtStartintegerat least 0
-
entriesintegerat least 0
-
exitsintegerat least 0
-
previousEntriesintegerat least 0
-
previousExitsintegerat least 0
-
-
monthsobject[]6 properties
-
datestring -
activeMembersintegerat least 0
-
entriesintegerat least 0
-
exitsintegerat least 0
-
ageGroupsobject of integer -
departmentsobject of integernullable
-
-
ageGroupsobject[]4 properties
-
keystring -
labelstring -
agesinteger[]nullable -
countintegerat least 0
-
-
departmentsobject[]nullable6 properties
-
departmentid -
parentidnullable -
namestring -
colorstring -
countintegerat least 0
-
nestedCountintegerat least 0
-
-
upcomingChangesobject[]4 properties
-
contactIdid -
namestring -
celebrationTypestringbirthdayanniversaryexitentry -
datestring
-
-
celebrationsobject[]5 properties
-
contactIdid -
namestring -
celebrationTypestringbirthdayanniversaryexitentry -
datestring -
yearsnumber
-
{
"summary": {
"active": 0,
"activeAtStart": 0,
"entries": 0,
"exits": 0,
"previousEntries": 0,
"previousExits": 0
},
"months": [
{
"date": "string",
"activeMembers": 0,
"entries": 0,
"exits": 0,
"ageGroups": {
"key": 1
},
"departments": {
"key": 1
}
}
],
"ageGroups": [
{
"key": "string",
"label": "string",
"ages": [
1
],
"count": 0
}
],
"departments": [
{
"department": "000000000000000000000001",
"parent": "000000000000000000000001",
"name": "string",
"color": "string",
"count": 0,
"nestedCount": 0
}
],
"upcomingChanges": [
{
"contactId": "000000000000000000000001",
"name": "string",
"celebrationType": "birthday",
"date": "string"
}
],
"celebrations": [
{
"contactId": "000000000000000000000001",
"name": "string",
"celebrationType": "birthday",
"date": "string",
"years": 1
}
]
}
Errors
No errors of its own are known for this endpoint.
Errors nearly every request can meet are listed under Errors.