/v1/margin
Margin of error for a sample size
Provalo dal vivo
10 chiamate gratuite al giorno — senza registrazione, senza chiave API. Passa dal gateway oanor.
Funziona. Prendi una chiave API e usala nel tuo progetto.
Ottieni una chiave APIFrammenti di codice
curl "https://api.oanor.com/samplesize-api/v1/margin" \ -H "x-oanor-key: oanor_test_..."
await fetch("https://api.oanor.com/samplesize-api/v1/margin", {
headers: { "x-oanor-key": "oanor_test_..." }
});
$ch = curl_init("https://api.oanor.com/samplesize-api/v1/margin");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["x-oanor-key: oanor_test_..."]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$out = curl_exec($ch);
import requests
requests.get(
"https://api.oanor.com/samplesize-api/v1/margin",
headers={"x-oanor-key": "oanor_test_..."}
)
Risposta di esempio
Una risposta reale di questo endpoint, acquisita dall'ultimo health check.
{
"data": {
"kind": "proportion",
"note": "Proportion margin of error E = z·√(p(1−p)/n). A sample of 385 gives about ±5 % at 95 %.",
"inputs": {
"confidence": 0.95,
"proportion": 0.5,
"sample_size": 385
},
"z_score": 1.959964,
"margin_of_error": 0.04994451,
"margin_of_error_percent": 4.994451
},
"meta": {
"timestamp": "2026-06-05T19:50:22.175Z",
"request_id": "da6c5007-d870-4981-acd8-e8d04727955e"
},
"status": "ok",
"message": "Margin of error",
"success": true
}