added get rapporto prova
This commit is contained in:
parent
e8b15d8096
commit
3816bf5a20
@ -31,6 +31,6 @@ Content-Length: 51
|
||||
< strict-transport-security: max-age=2592000
|
||||
< x-powered-by: ASP.NET
|
||||
< x-content-type-options: nosniff
|
||||
< date: Wed, 04 Jun 2025 08:46:14 GMT
|
||||
< date: Wed, 02 Jul 2025 12:18:49 GMT
|
||||
<
|
||||
* Connection #0 to host 93.43.5.102 left intact
|
||||
|
||||
@ -10,16 +10,16 @@
|
||||
* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
|
||||
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
|
||||
* using HTTP/2
|
||||
* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/odata/Cliente
|
||||
* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/odata/Rapporto(515081)?$expand=CampioniDatiRapporto($expand=AnalisiDatiRapporto,CustomFieldsDatiRapporto)
|
||||
* [HTTP/2] [1] [:method: GET]
|
||||
* [HTTP/2] [1] [:scheme: https]
|
||||
* [HTTP/2] [1] [:authority: 93.43.5.102]
|
||||
* [HTTP/2] [1] [:path: /limsapi/api/odata/Cliente]
|
||||
* [HTTP/2] [1] [authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0OTAzMzk3NCwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.t2vQFN7t5Dxiydv2M8WLDqzc7MmYEhShueb69ncpgqI]
|
||||
* [HTTP/2] [1] [:path: /limsapi/api/odata/Rapporto(515081)?$expand=CampioniDatiRapporto($expand=AnalisiDatiRapporto,CustomFieldsDatiRapporto)]
|
||||
* [HTTP/2] [1] [authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc1MTQ2NTkyOSwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.FNZzl12U_ixDiKE3bkILSUVGvAJd8HGAmL0VUEYS__0]
|
||||
* [HTTP/2] [1] [accept: application/json]
|
||||
> GET /limsapi/api/odata/Cliente HTTP/2
|
||||
> GET /limsapi/api/odata/Rapporto(515081)?$expand=CampioniDatiRapporto($expand=AnalisiDatiRapporto,CustomFieldsDatiRapporto) HTTP/2
|
||||
Host: 93.43.5.102
|
||||
Authorization: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Tc1MTQ2NTkyOSwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.FNZzl12U_ixDiKE3bkILSUVGvAJd8HGAmL0VUEYS__0
|
||||
Accept: application/json
|
||||
|
||||
< HTTP/2 200
|
||||
@ -30,6 +30,6 @@ Accept: application/json
|
||||
< odata-version: 4.0
|
||||
< x-powered-by: ASP.NET
|
||||
< x-content-type-options: nosniff
|
||||
< date: Wed, 04 Jun 2025 08:46:43 GMT
|
||||
< date: Wed, 02 Jul 2025 12:18:50 GMT
|
||||
<
|
||||
* Connection #0 to host 93.43.5.102 left intact
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
public/userarea/error_log.txt
Normal file
4
public/userarea/error_log.txt
Normal file
@ -0,0 +1,4 @@
|
||||
2025-06-10 12:21:44 - Errore nel recupero dati: HTTP 404, Risposta:
|
||||
2025-06-16 11:15:30 - Errore nel recupero dati: HTTP 404, Risposta: {"title":"Not Found","status":404,"detail":"Not Found","instance":"GET /api/odata/Rapporto(2523026)","errorCode":"d25cbd678"}
|
||||
2025-06-16 11:34:59 - Autenticazione fallita: HTTP 0, Errore cURL: Failed to connect to 93.43.5.102 port 443 after 21033 ms: Couldn't connect to server, Risposta:
|
||||
2025-06-16 11:42:03 - Errore nella richiesta: Recv failure: Connection was reset
|
||||
26
public/userarea/get_rapporto_prova.php
Normal file
26
public/userarea/get_rapporto_prova.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?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();
|
||||
$rapporto_id = 515081;
|
||||
|
||||
// Costruzione manuale dell'endpoint con espansione annidata
|
||||
$endpoint = "Rapporto($rapporto_id)?\$expand=CampioniDatiRapporto(\$expand=AnalisiDatiRapporto,CustomFieldsDatiRapporto)";
|
||||
|
||||
// Non passiamo options, già incluso nell'endpoint
|
||||
$data = $api->get($endpoint);
|
||||
|
||||
file_put_contents(__DIR__ . '/rapporto_expanded.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||
echo json_encode($data);
|
||||
} catch (Exception $e) {
|
||||
file_put_contents(__DIR__ . '/error_log.txt', date('Y-m-d H:i:s') . ' - ' . $e->getMessage() . PHP_EOL, FILE_APPEND);
|
||||
http_response_code(500);
|
||||
echo json_encode(['error' => $e->getMessage()]);
|
||||
}
|
||||
@ -1,116 +1,38 @@
|
||||
```php
|
||||
<?php
|
||||
require_once dirname(__DIR__, 2) . '/vendor/autoload.php'; // Torna al livello di public per trovare vendor/
|
||||
require_once dirname(__FILE__) . '/class/VisualLimsApiClient.class.php';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$base_url = 'https://93.43.5.102/limsapi';
|
||||
$credentials = [
|
||||
'Username' => 'WebApiUser',
|
||||
'Password' => 'webapiuser01'
|
||||
];
|
||||
// Disabilita la visualizzazione degli errori PHP per evitare output HTML
|
||||
ini_set('display_errors', '0');
|
||||
error_reporting(E_ALL);
|
||||
|
||||
// Leggi l'ID del cliente dal body della richiesta
|
||||
$input = json_decode(file_get_contents('php://input'), true);
|
||||
$clienteId = isset($input['clienteId']) ? $input['clienteId'] : null;
|
||||
try {
|
||||
$api = VisualLimsApiClient::getInstance();
|
||||
$cliente_id = 4202; // Usa l'ID cliente fornito dal cliente
|
||||
$options = ['$expand' => 'SchemiAbilitati']; // Usa $expand con il prefisso $
|
||||
|
||||
if (!$clienteId) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => 'ID cliente non fornito']);
|
||||
exit;
|
||||
}
|
||||
// Debug: Costruisci manualmente l'URL per verifica
|
||||
$base_url = 'https://93.43.5.102/limsapi/api/odata/';
|
||||
$endpoint = "Cliente({$cliente_id})";
|
||||
$query = http_build_query($options);
|
||||
$full_url = $base_url . $endpoint . '?' . $query;
|
||||
file_put_contents(__DIR__ . '/last_url.txt', $full_url . PHP_EOL, FILE_APPEND);
|
||||
|
||||
// Autenticazione → ottieni token
|
||||
$ch = curl_init("$base_url/api/authentication/authenticate");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($credentials));
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json'
|
||||
]);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||
$log = fopen('curl_auth_debug.log', 'w');
|
||||
curl_setopt($ch, CURLOPT_STDERR, $log);
|
||||
$data = $api->get($endpoint, $options); // Recupera il cliente con schemi abilitati
|
||||
|
||||
$response = curl_exec($ch);
|
||||
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
$curl_error = curl_error($ch);
|
||||
fclose($log);
|
||||
curl_close($ch);
|
||||
// Salva la risposta in un file per debug
|
||||
file_put_contents(__DIR__ . '/schemi_response.json', json_encode($data));
|
||||
|
||||
// Verifica la risposta
|
||||
if ($response === false || $http_code != 200) {
|
||||
http_response_code($http_code ? $http_code : 500);
|
||||
echo json_encode($data);
|
||||
} catch (Exception $e) {
|
||||
// Log dell'errore per debug
|
||||
file_put_contents(__DIR__ . '/error_log.txt', date('Y-m-d H:i:s') . ' - ' . $e->getMessage() . PHP_EOL, FILE_APPEND);
|
||||
http_response_code(500);
|
||||
echo json_encode([
|
||||
'error' => 'Errore nella richiesta di autenticazione',
|
||||
'http_code' => $http_code,
|
||||
'curl_error' => $curl_error,
|
||||
'raw_response' => substr($response, 0, 1000)
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Decodifica la risposta JSON
|
||||
$token_data = json_decode($response, true);
|
||||
|
||||
// Gestisci sia il caso in cui la risposta è una stringa (token diretto) sia un oggetto con chiave 'token'
|
||||
$token = null;
|
||||
if (is_array($token_data) && isset($token_data['token'])) {
|
||||
$token = $token_data['token'];
|
||||
} elseif (is_string($token_data) && !empty($token_data)) {
|
||||
$token = trim($token_data, '"');
|
||||
} elseif (is_string($response) && !empty($response)) {
|
||||
$token = trim($response, '"');
|
||||
}
|
||||
|
||||
if (empty($token)) {
|
||||
http_response_code(401);
|
||||
echo json_encode([
|
||||
'error' => 'Token non ricevuto',
|
||||
'http_code' => $http_code,
|
||||
'curl_error' => $curl_error,
|
||||
'raw_response' => substr($response, 0, 1000)
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Chiamata GET per recuperare gli schemi del cliente
|
||||
$ch = curl_init("$base_url/api/odata/Cliente($clienteId)?\$expand=SchemiAbilitati");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
"Authorization: Bearer $token",
|
||||
"Accept: application/json"
|
||||
]);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||
$log = fopen('curl_schemi_debug.log', 'w');
|
||||
curl_setopt($ch, CURLOPT_STDERR, $log);
|
||||
|
||||
$schemi_response = curl_exec($ch);
|
||||
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
$curl_error = curl_error($ch);
|
||||
fclose($log);
|
||||
curl_close($ch);
|
||||
|
||||
if ($http_code === 200) {
|
||||
$schemi_data = json_decode($schemi_response, true);
|
||||
if (json_last_error() === JSON_ERROR_NONE) {
|
||||
echo json_encode($schemi_data);
|
||||
} else {
|
||||
http_response_code(500);
|
||||
echo json_encode([
|
||||
'error' => 'Risposta non JSON valida',
|
||||
'http_code' => $http_code,
|
||||
'response' => substr($schemi_response, 0, 1000)
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
http_response_code($http_code);
|
||||
echo json_encode([
|
||||
'error' => 'Errore nel recupero schemi',
|
||||
'http_code' => $http_code,
|
||||
'curl_error' => $curl_error,
|
||||
'response' => substr($schemi_response, 0, 1000)
|
||||
'error' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
?>
|
||||
26
public/userarea/get_schemi_custom_fields.php
Normal file
26
public/userarea/get_schemi_custom_fields.php
Normal file
@ -0,0 +1,26 @@
|
||||
```php
|
||||
<?php
|
||||
require_once dirname(__DIR__, 2) . '/vendor/autoload.php'; // Torna al livello di public per trovare vendor/
|
||||
require_once dirname(__FILE__) . '/class/VisualLimsApiClient.class.php';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// Disabilita la visualizzazione degli errori PHP per evitare output HTML
|
||||
ini_set('display_errors', '0');
|
||||
error_reporting(E_ALL);
|
||||
|
||||
try {
|
||||
$api = VisualLimsApiClient::getInstance();
|
||||
$data = $api->get("SchemaCustomField"); // Recupera la lista degli schemi custom fields
|
||||
|
||||
// Salva la risposta in un file per debug
|
||||
file_put_contents(__DIR__ . '/schemi_custom_fields_response.json', json_encode($data));
|
||||
|
||||
echo json_encode($data);
|
||||
} catch (Exception $e) {
|
||||
http_response_code(500);
|
||||
echo json_encode([
|
||||
'error' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
?>
|
||||
13340
public/userarea/json_example_bv.txt
Normal file
13340
public/userarea/json_example_bv.txt
Normal file
File diff suppressed because it is too large
Load Diff
8
public/userarea/last_url.txt
Normal file
8
public/userarea/last_url.txt
Normal file
@ -0,0 +1,8 @@
|
||||
https://93.43.5.102/limsapi/api/odata/Cliente(34)?expand=SchemiAbilitati
|
||||
https://93.43.5.102/limsapi/api/odata/Cliente(55)?expand=SchemiAbilitati
|
||||
https://93.43.5.102/limsapi/api/odata/Cliente(4202)?expand=SchemiAbilitati
|
||||
https://93.43.5.102/limsapi/api/odata/Cliente(4202)?expand=SchemiAbilitati
|
||||
https://93.43.5.102/limsapi/api/odata/Cliente(4202)?%24expand=SchemiAbilitati
|
||||
https://93.43.5.102/limsapi/api/odata/Cliente(4202)?%24expand=SchemiAbilitati
|
||||
https://93.43.5.102/limsapi/api/odata/Rapporto(2523026)?%24expand=CampioniDatiRapporto%2CAnalisiDatiRapporto%2CCustomFieldsDatiRapporto
|
||||
https://93.43.5.102/limsapi/api/odata/Cliente(4202)?%24expand=SchemiAbilitati
|
||||
11
public/userarea/rapporto_espanso_response.json
Normal file
11
public/userarea/rapporto_espanso_response.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"@odata.context": "https:\/\/93.43.5.102\/limsapi\/api\/odata\/$metadata#Rapporto\/$entity",
|
||||
"IdRapporto": 515081,
|
||||
"DataUltimaModifica": "2025-05-14T18:11:21.02+02:00",
|
||||
"DaLeggere": false,
|
||||
"CodiceRapporto": "2523026",
|
||||
"Data": "2025-05-14T14:05:30+02:00",
|
||||
"Versione": 0,
|
||||
"DataStampa": "2025-05-14T14:11:00+02:00",
|
||||
"Firmato": true
|
||||
}
|
||||
13340
public/userarea/rapporto_expanded.json
Normal file
13340
public/userarea/rapporto_expanded.json
Normal file
File diff suppressed because it is too large
Load Diff
1
public/userarea/schemi_custom_fields_response.json
Normal file
1
public/userarea/schemi_custom_fields_response.json
Normal file
File diff suppressed because one or more lines are too long
1
public/userarea/schemi_response.json
Normal file
1
public/userarea/schemi_response.json
Normal file
@ -0,0 +1 @@
|
||||
{"@odata.context":"https:\/\/93.43.5.102\/limsapi\/api\/odata\/$metadata#Cliente\/$entity","IdCliente":4202,"DataUltimaModifica":"2025-01-09T12:58:07.743+01:00","EMails":["elisa.memo@moncler.com"],"EMailsPec":[],"CodiceCliente":"BL01858_RM-ACC_E","Nominativo":"INDUSTRIES SPA_RM-ACC","Indirizzo":"VIA STENDHAL 47","Citt\u00e0":"MILANO","Cap":"20144","Provincia":"MI","CodiceASL":null,"PartitaIva":"04804070961","CodiceFiscale":null,"FattureCodiceDestinatario":"SN4CSRI","FattureRiferimento":null,"CodiceNazioneFatturazione":"IT"}
|
||||
Loading…
x
Reference in New Issue
Block a user