Change Client Integration State

Change the state of the client integration

PATCH https://integrate.d6plus.co.za/api/v1/settings/clients/{school_login_id}

Use this endpoint to change the state of the integration for a client who has authorised your integration in their d6+ SAMS instance. This state indicates whether you are actively servicing the client or not.

Path Parameters

NameTypeDescription

school_login_id*

Integer

The login ID of the school to retrieve data from

Headers

NameTypeDescription

HTTP-X-USERNAME*

String

As provided by d6

HTTP-X-PASSWORD*

String

As provided by d6

Request Body

NameTypeDescription

state*

Integer

The state you would like to set the integration to

api_type_id*

Integer

The api_type_id returned by the Get Clients endpoint

[]

Examples

<?php

const BASE_URL = 'https://integrate.d6plus.co.za/api/v1/settings/clients';
const SCHOOL_LOGIN_ID = '1000';
const API_USERNAME = getenv('API_USERNAME'); // Assuming you have these environment variables set
const API_PASSWORD = getenv('API_PASSWORD');

$data = [
    "api_type_id" => 8,
    "state" => 1
]; 
$jsonData = json_encode($data);

$curl = curl_init();

$query = http_build_query(PARAMS);

$options = [
    CURLOPT_URL => BASE_URL . '/' . SCHOOL_LOGIN_ID,
    CURLOPT_URL => BASE_URL,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_SSL_VERIFYPEER => true,
    CURLOPT_CUSTOMREQUEST => 'PATCH',
    CURLOPT_POSTFIELDS => $jsonData,    
    CURLOPT_HTTPHEADER => [
        "HTTP-X-USERNAME: " . API_USERNAME,
        "HTTP-X-PASSWORD: " . API_PASSWORD,
        "Content-Type: application/json",
        "Content-Length: " . strlen($jsonData)        
    ],
];

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