Update Note
PATCH
/v2/finplus/debtmanagement/debtornotes/notes/{id}
Use this endpoint to update an existing debtor note for a specified school.
The note ID must be passed in the URL and can be retrieved using the Get Note(s) call.
If you need to update the payment arrangements attached to a promise-to-pay note, include the updated data in the
promise_to_pays
array (see details below).To update an existing promise-to-pay entry, provide its
promise_to_pay_id
. This ID can be retrieved using either the Get Note(s) or Get Promise To Pay(s) call.If a
promise_to_pay_id
is not included, a new promise-to-pay entry will be created.The API will not allow a duplicate promise-to-pay entry to be added if both
date_promised
andamount_promised
match an existing record.To restore a previously deleted note, provide the
note_id
and set thestatus
field to"Created"
.For a detailed explanation of individual fields, refer to the Create Note documentation.
Path Parameters
{id}
*
Integer
The Note ID of the note to be updated
Request Headers
HTTP-X-USERNAME
*
String
As provided by d6
HTTP-X-PASSWORD
*
String
As provided by d6
HTTP-X-SCHOOLID
*
Integer
The unique identifier of the school for which the data is being queried.
Request Body
accountable_person_id
Integer
The id of the accountable person who the note belongs to.
date
String
The date of the note in "yyyy-mm-dd" format.
note_type_id
Integer
The id of the note type.
communication_type_id
Integer
The id of the communication type (not required for internal notes).
note
String
The note text
status
String
The status of the note (either "Created" or "Deleted")
promise_to_pays
Array
An array of payment arrangement data for promise-to-pay notes
Request Examples
{
"note_id": 7,
"date": "2024-04-16",
"note": "Mr Webster asked to be phoned back tomorrow at 10am"
}
Response Examples
Status: 200 OK
{
"success": true,
"message": "Note updated successfully",
"data": {
"note_id": 7,
"accountable_person_id": 3,
"accountable_person": "Mr Webster, Nic",
"debtor_code": "1002",
"debtor_reference": "Webster",
"date": "2024-04-15",
"note_type_id": 3,
"note_type": "Internal",
"communication_type_id": 7,
"communication_type": "Internal",
"note": "Mr Webster asked to be phoned back tomorrow at 10am",
"status": "Created"
}
}
Code Samples
<?php
// API Credentials
$api_username = 'your_username';
$api_password = 'your_password';
$school_id = 'the_school_id';
// Note ID to update (retrieved from Get Note(s) or Get Promise To Pay(s) calls)
$note_id = '1234';
// Base API endpoint with note_id appended
define('BASE_URL', 'https://integrate.d6plus.co.za/api/v2/finplus/debtmanagement/debtornotes/notes');
$url = BASE_URL . '/' . $note_id;
// Request payload data
$request_data = [
"accountable_person_id" => 1234, // Replace with actual accountable person ID
"date" => "2025-04-01", // Date of the note in "YYYY-MM-DD" format
"note_type_id" => 2, // Replace with actual note type ID
"communication_type_id" => 1, // Required for all note types except Internal Notes
"note" => "Updated debtor note text.",
"status" => "Created", // Use "Created" to restore a deleted note
"promise_to_pays" => [ // Optional: Promise-to-pay details
[
"promise_to_pay_id" => 5678, // To update an existing promise-to-pay, include its ID. Omit to create a new one.
"date_promised" => "2025-05-15",
"amount_promised" => "2000.00"
]
]
];
// Initialize cURL
$curl = curl_init();
// Set cURL options
curl_setopt_array($curl, [
CURLOPT_URL => $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($request_data),
CURLOPT_HTTPHEADER => [
"HTTP-X-USERNAME: $api_username",
"HTTP-X-PASSWORD: $api_password",
"HTTP-X-SCHOOLID: $school_id",
"Content-Type: application/json"
],
]);
// Execute the request
$response = curl_exec($curl);
// Check for errors
$error = curl_error($curl);
if ($error) {
curl_close($curl);
throw new Exception("cURL Error: $error");
}
// Close cURL session and output the response
curl_close($curl);
echo $response;