Get learner discipline records
GET
https://integrate.d6plus.co.za/api/v1/adminplus/learnerdiscipline/{school_login_id}
Use this endpoint to fetch discipline records for one or more learners for the specified school. By default, all discipline records for the last month will be returned, regardless of the associated learners current status.
It is possible to retrieve discipline records for a single learner by providing the optional learner_id
query parameter.
It is possible to specify a different date range by providing the optional from_date
and to_date
query parameters.
The following validation applies:
- The to_date
may not be before the from_date
.
- The date range may not span more than 31 days.
Path Parameters
The login ID of the school to retrieve data from
Query Parameters
The ID of a specific learner
Range end date in format YYYY-MM-DD
Range start date in format YYYY-MM-DD
Copy [
{
"id": "1",
"learner_id": "2",
"discipline_date": "2023-06-30",
"discipline_category": "Level 1",
"discipline_reason": "Appearance : Hair / Nails",
"discipline_points": "-1",
"discipline_remarks": "",
"staff_member_id": "3"
},
{
"id": "2",
"learner_id": "1",
"discipline_date": "2023-07-03",
"discipline_category": "General",
"discipline_reason": "Handed in lost goods/money",
"discipline_points": "3",
"discipline_remarks": "",
"staff_member_id": "4"
}
]
Copy {
"error": "Not found",
"error_description": "No learner discipline records found"
}
Copy {
"error": "Unauthorized",
"error_description": "Client access not authorised"
}
Copy {
"error": "Integration not activated",
"error_description": "Please activate the Admin+ API for this client before making this request"
}
Examples
Copy <?php
const BASE_URL = 'https://integrate.d6plus.co.za/api/v1/adminplus/learnerdiscipline';
const SCHOOL_LOGIN_ID = '1000';
const PARAMS = [
'learner_id' => 1,
'from_date' => '2023-06-01',
'to_date' => '2023-06-14'
];
const API_USERNAME = getenv('API_USERNAME'); // Assuming you have these environment variables set
const API_PASSWORD = getenv('API_PASSWORD');
$curl = curl_init();
$query = http_build_query(PARAMS);
$options = [
CURLOPT_URL => BASE_URL . '/' . SCHOOL_LOGIN_ID . '?' . $query,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
"HTTP-X-USERNAME: " . API_USERNAME,
"HTTP-X-PASSWORD: " . API_PASSWORD
],
];
curl_setopt_array($curl, $options);
$response = curl_exec($curl);
if (curl_errno($curl)) {
throw new Exception('Curl error: ' . curl_error($curl));
}
curl_close($curl);
echo $response;
Copy curl --location 'https://integrate.d6plus.co.za/api/v1/adminplus/learnerdiscipline/1000?learner_id=1&from_date=2023-06-01&to_date=2023-06-14' \
--header 'HTTP-X-USERNAME: your_username' \
--header 'HTTP-X-PASSWORD: your_password'