Vai al contenuto
GET /v1/proportion

Sample size for a proportion

Provalo dal vivo

10 chiamate gratuite al giorno — senza registrazione, senza chiave API. Passa dal gateway oanor.

Intestazioni personalizzate (facoltative)
api.oanor.com/samplesize-api

Funziona. Prendi una chiave API e usala nel tuo progetto.

Ottieni una chiave API

Frammenti di codice

curl "https://api.oanor.com/samplesize-api/v1/proportion" \
  -H "x-oanor-key: oanor_test_..."
await fetch("https://api.oanor.com/samplesize-api/v1/proportion", {
  headers: { "x-oanor-key": "oanor_test_..." }
});
$ch = curl_init("https://api.oanor.com/samplesize-api/v1/proportion");
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/proportion",
    headers={"x-oanor-key": "oanor_test_..."}
)

Risposta di esempio

Una risposta reale di questo endpoint, acquisita dall'ultimo health check.

{
    "data": {
        "note": "Proportion sample size n = z²·p(1−p)/E²; p = 0.5 is the worst case (largest n). With a population N the finite-population correction is applied. A ±5 % margin at 95 % needs 385.",
        "inputs": {
            "confidence": 0.95,
            "proportion": 0.5,
            "margin_of_error": 0.05
        },
        "z_score": 1.959964,
        "unrounded": 384.1459,
        "required_sample_size": 385
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:22.395Z",
        "request_id": "776ba2fe-fbf4-4b28-9c11-ab5961ff28e2"
    },
    "status": "ok",
    "message": "Sample size for a proportion",
    "success": true
}