31 lines
964 B
PHP
31 lines
964 B
PHP
<?php
|
|
require_once dirname(__DIR__, 2) . '/vendor/autoload.php';
|
|
require_once dirname(__FILE__) . '/class/VisualLimsApiClient.class.php';
|
|
|
|
header('Content-Type: application/json');
|
|
ini_set('display_errors', '0');
|
|
error_reporting(E_ALL);
|
|
|
|
try {
|
|
$api = VisualLimsApiClient::getInstance();
|
|
|
|
// ID dello schema passato via GET o default 45
|
|
$schemaId = isset($_GET['id']) && is_numeric($_GET['id']) ? intval($_GET['id']) : 42;
|
|
|
|
// IMPORTANTE: $expand va dentro la stringa endpoint per entità singola
|
|
$endpoint = "SchemaCustomField($schemaId)?\$expand=SchemiCustomFieldsDettagli(\$expand=CustomField)";
|
|
|
|
// Nessun parametro aggiuntivo
|
|
$data = $api->get($endpoint);
|
|
|
|
// Salva la risposta per debug
|
|
file_put_contents(__DIR__ . '/schema_dettagli_response.json', json_encode($data));
|
|
|
|
echo json_encode($data);
|
|
} catch (Exception $e) {
|
|
http_response_code(500);
|
|
echo json_encode([
|
|
'error' => $e->getMessage()
|
|
]);
|
|
}
|