surveys
POST /v1/surveys/{survey_id}/responses
Record one person's answers to one survey.
Autenticación
Envía una clave de API como token de portador. La clave debe tener el permiso org.read; una clave que no lo tenga se rechazará con un código 403, no 404.
Donde va el ID de tu organización
Este endpoint toma org_id como un campo en el cuerpo JSON.
El id de tu organización se encuentra en la pantalla de claves de API en tu panel de control, junto a la propia clave. Es el mismo id en cada llamada que realices.
Pruébalo
Reemplaza cualquier elemento entre corchetes angulares por tus propios valores, y el marcador de posición key con una clave de tu panel de control.
curl -X POST https://api.zinndigital.com/v1/surveys/{survey_id}/responses \
-H "Authorization: Bearer zdk_live_…" \
-H "Content-Type: application/json" \
-d '{ "answers": <SurveyAnswer[]> }'¿Has iniciado sesión? La consola de la API en tu panel de control rellena el ID de tu organización real y tu propia clave, y ejecuta la solicitud contra la API en vivo para que puedas ver la respuesta real. Abre este endpoint en la consola de la API
Detalles
Stored in our own organisation-scoped table FIRST and unconditionally, then mirrored to the behavioural backend so the analytics join resolves. The two copies have opposite error policies deliberately: losing the customer's answer is unacceptable, losing the vendor's copy of an answer we already hold costs a join. ⛔ The survey is re-fetched and re-checked against the store — a client sends an id, and a client is a thing a person can edit. Answering an archived or stopped survey is refused. A SECOND answer from the same person returns `200` with `duplicate: true` rather than a conflict: the unique constraint exists to stop a doubled count, and the commonest way it fires is a retry after a dropped connection. Requires `org.read`.
Parámetros
| Nombre | Tipo | Obligatorio | ¿Qué es esto? |
|---|---|---|---|
survey_id (path) | string | Sí | — |
Cuerpo de la solicitud
| Nombre | Tipo | Obligatorio | ¿Qué es esto? |
|---|---|---|---|
org_id | string | No | — |
distinct_id | string | No | The browser's analytics distinct id. ⛔ Without it the mirrored event attaches to a person who does not exist, and the join looks healthy and is empty. |
path | string | No | — |
answers | SurveyAnswer[] | Sí | — |
Respuesta
| Nombre | Tipo | Obligatorio | ¿Qué es esto? |
|---|---|---|---|
recorded | boolean | Sí | — |
duplicate | boolean | Sí | True when this person had already answered. ⛔ Reported as a success, not a conflict — the commonest cause is a retry after a dropped connection, and telling the customer it fail… |
id | string | No | — |
Errores que este endpoint puede devolver
401 · 403 · 404 · 422