Change Client Integration State
POST
/v1/settings/clientintegrations
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.
Request Headers
Name
Type
Description
HTTP-X-USERNAME
*
String
As provided by d6
HTTP-X-PASSWORD
*
String
As provided by d6
Request Body
Name
Type
Description
school_id
*
Integer
The ID of the school to update
api_type_id
*
Integer
The api_type_id returned by the Get Clients endpoint
state
*
Boolean
The state you would like to set the integration to
Response Examples
Status: 200 OK
{
"success": true,
"message": "Integration successfully activated",
"data": {
"school_id": 1000,
"school_name": "d6+ Primary School",
"admin_email_address": "[email protected]",
"telephone_calling_code": "27",
"telephone_number": "0123334444",
"api_type_id": 8,
"api_type": "Admin+ API",
"activated_by_integrator": "Yes" // <-
}
}
Code Samples
<?php
// API Endpoint
const BASE_URL = 'https://integrate.d6plus.co.za/api/v2/settings/clientintegrations';
// API Credentials
const API_USERNAME = 'your_username';
const API_PASSWORD = 'your_password';
// Request payload
$data = [
"school_id" => 1000,
"api_type_id" => 8,
"state" => 1
];
// Initialize cURL
$curl = curl_init();
// Set cURL options
curl_setopt_array($curl, [
CURLOPT_URL => BASE_URL,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30, // Set timeout to prevent hanging requests
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_POSTFIELDS => json_encode($data), // Encode array as JSON
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"HTTP-X-USERNAME: " . API_USERNAME,
"HTTP-X-PASSWORD: " . API_PASSWORD
],
]);
// Execute request
$response = curl_exec($curl);
// Check for errors
if (curl_errno($curl)) {
throw new Exception('Curl error: ' . curl_error($curl));
}
// Close cURL session
curl_close($curl);
// Output response
echo $response;