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

Headers

Request Body

[]

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