surveys
POST /v1/surveys/{survey_id}/responses
Record one person's answers to one survey.
Autenticação
Envie uma chave de API como um token de portador. A chave deve ter a permissão org.read; uma chave sem ela é recusada com 403, e não 404.
Onde vai o ID da sua organização
Este endpoint aceita org_id como um campo no corpo JSON.
O ID da sua organização está na tela de chaves de API no seu painel, ao lado da própria chave. É o mesmo ID em todas as chamadas que você fizer.
Experimente
Substitua qualquer item entre colchetes por seus próprios valores e o espaço reservado para a chave por uma chave do seu painel.
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[]> }'Conectado? O console da API no seu painel preenche o ID da sua organização real e a sua própria chave, e executa a requisição contra a API de produção para que você possa ver a resposta real. Abra este endpoint no console da API
Detalhes
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
| Nome | Tipo | Obrigatório | O que é |
|---|---|---|---|
survey_id (path) | string | Sim | — |
Corpo da requisição
| Nome | Tipo | Obrigatório | O que é |
|---|---|---|---|
org_id | string | Não | — |
distinct_id | string | Não | 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 | Não | — |
answers | SurveyAnswer[] | Sim | — |
Resposta
| Nome | Tipo | Obrigatório | O que é |
|---|---|---|---|
recorded | boolean | Sim | — |
duplicate | boolean | Sim | 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 | Não | — |
Erros que este endpoint pode retornar
401 · 403 · 404 · 422