Get Learner Discipline

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

NameTypeDescription

school_login_id*

Integer

The login ID of the school to retrieve data from

Query Parameters

NameTypeDescription

learner_id

Integer

The ID of a specific learner

to_date

String

Range end date in format YYYY-MM-DD

from_date

String

Range start date in format YYYY-MM-DD

Headers

NameTypeDescription

HTTP-X-USERNAME*

String

As provided by d6

HTTP-X-PASSWORD*

String

As provided by d6

[
    {
        "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"
    }
]

Examples

<?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;

Last updated