Skip to main content

Departments Endpoints

Browse available departments and check availability.

PHP and Java SDKs

The PHP and Java examples below use the official SDK syntax — not yet published on Packagist/Maven Central (see PHP SDK and Java SDK). Node.js and Python are published and usable today.

GET /departments​

Lists all departments for your organization.

Request​

curl https://mc-prd.duckdns.org/api/v1/departments \
-H "X-API-Key: YOUR_API_KEY"
Java
import com.moncreneau.Moncreneau;
import java.util.List;
import java.util.Map;

Moncreneau client = new Moncreneau("your_api_key");
List<Map<String, Object>> departments = client.departments.list();

for (Map<String, Object> dept : departments) {
System.out.println(dept.get("name") + " - " + dept.get("address"));
}
Node.js
import Moncreneau from '@moncreneau/api';

const client = new Moncreneau('your_api_key');

const departments = await client.departments.list();
departments.forEach(dept => {
console.log(`${dept.name} - ${dept.address}`);
});
PHP
<?php
use Moncreneau\Moncreneau;

$client = new Moncreneau('your_api_key');
$departments = $client->departments->list();

foreach ($departments as $dept) {
echo $dept['name'] . ' - ' . $dept['address'] . PHP_EOL;
}
Python
from moncreneau import Moncreneau

client = Moncreneau('your_api_key')
departments = client.departments.list()

for dept in departments:
print(f"{dept['name']} - {dept['address']}")

Response 200​

[
{
"id": 5,
"name": "General Consultation",
"address": "123 Rue de la Santé, Conakry",
"phoneNumber": "+224 123 456 789",
"slotInterval": 30,
"workingHours": "Mon-Fri: 08:00-17:00"
},
{
"id": 8,
"name": "Emergency",
"address": "456 Avenue de la République",
"phoneNumber": "+224 987 654 321",
"slotInterval": 15,
"workingHours": "Mon-Sun: 00:00-23:59"
}
]

GET /departments/{id}​

Retrieves a specific department's details.

Request​

curl https://mc-prd.duckdns.org/api/v1/departments/5 \
-H "X-API-Key: YOUR_API_KEY"
Java
import com.moncreneau.Moncreneau;
import java.util.Map;

Moncreneau client = new Moncreneau("your_api_key");
Map<String, Object> dept = client.departments.retrieve("5");

System.out.println("Name: " + dept.get("name"));
System.out.println("Address: " + dept.get("address"));
System.out.println("Interval: " + dept.get("slotInterval") + " minutes");
Node.js
import Moncreneau from '@moncreneau/api';

const client = new Moncreneau('your_api_key');
const dept = await client.departments.retrieve('5');

console.log(`Name: ${dept.name}`);
console.log(`Address: ${dept.address}`);
console.log(`Interval: ${dept.slotInterval} minutes`);
PHP
<?php
use Moncreneau\Moncreneau;

$client = new Moncreneau('your_api_key');
$dept = $client->departments->retrieve('5');

echo "Name: {$dept['name']}" . PHP_EOL;
echo "Address: {$dept['address']}" . PHP_EOL;
echo "Interval: {$dept['slotInterval']} minutes" . PHP_EOL;
Python
from moncreneau import Moncreneau

client = Moncreneau('your_api_key')
dept = client.departments.retrieve('5')

print(f"Name: {dept['name']}")
print(f"Address: {dept['address']}")
print(f"Interval: {dept['slotInterval']} minutes")

Response 200​

{
"id": 5,
"name": "General Consultation",
"address": "123 Rue de la Santé, Conakry",
"phoneNumber": "+224 123 456 789",
"slotInterval": 30,
"workingHours": "Mon-Fri: 08:00-17:00"
}

Response 404​

{
"error": {
"code": "DEPARTMENT_NOT_FOUND",
"message": "Department not found with id: 5"
}
}

GET /departments/{id}/availability​

Checks availability for a specific time slot of a department (a single dateTime — not a date range).

Request​

curl "https://mc-prd.duckdns.org/api/v1/departments/5/availability?dateTime=2026-02-15T10:00:00" \
-H "X-API-Key: YOUR_API_KEY"
Java
import com.moncreneau.Moncreneau;
import java.util.Map;

Moncreneau client = new Moncreneau("your_api_key");

Map<String, Object> availability = client.departments.getAvailability("5", "2026-02-15T10:00:00");

if (Boolean.TRUE.equals(availability.get("available"))) {
System.out.println("Slot available! Remaining slots: " + availability.get("remainingSlots"));
} else {
System.out.println("Slot unavailable: " + availability.get("unavailabilityReason"));
}
Node.js
import Moncreneau from '@moncreneau/api';

const client = new Moncreneau('your_api_key');

const availability = await client.departments.getAvailability('5', '2026-02-15T10:00:00');

if (availability.available) {
console.log(`Slot available! Remaining slots: ${availability.remainingSlots}`);
} else {
console.log(`Slot unavailable: ${availability.unavailabilityReason}`);
}
PHP
<?php
use Moncreneau\Moncreneau;

$client = new Moncreneau('your_api_key');

$availability = $client->departments->getAvailability('5', '2026-02-15T10:00:00');

if ($availability['available']) {
echo "Slot available! Remaining slots: {$availability['remainingSlots']}" . PHP_EOL;
} else {
echo "Slot unavailable: {$availability['unavailabilityReason']}" . PHP_EOL;
}
Python
from moncreneau import Moncreneau

client = Moncreneau('your_api_key')

availability = client.departments.get_availability('5', '2026-02-15T10:00:00')

if availability['available']:
print(f"Slot available! Remaining slots: {availability['remainingSlots']}")
else:
print(f"Slot unavailable: {availability['unavailabilityReason']}")

Response 200 - Available​

{
"slotTime": "2026-02-15T10:00:00",
"available": true,
"remainingSlots": 3,
"unavailabilityReason": null
}

Response 200 - Unavailable​

{
"slotTime": "2026-02-15T10:00:00",
"available": false,
"remainingSlots": 0,
"unavailabilityReason": "Slot full (5/5 appointments)"
}

Response 400 - Invalid date​

{
"error": {
"code": "INVALID_DATE_FORMAT",
"message": "dateTime must be an ISO-8601 date-time, e.g. 2026-01-05T16:30:00"
}
}