surveys

POST /v1/surveys/{survey_id}/responses

Record one person's answers to one survey.

Semua titik akhir surveys

Autentikasi

Kirim kunci API sebagai token bearer. Kunci tersebut harus memiliki izin org.read; kunci tanpa izin tersebut akan ditolak dengan status 403, bukan 404.

Tempat ID organisasi Anda dimasukkan

Titik akhir ini memerlukan org_id sebagai field dalam bodi JSON.

ID organisasi Anda berada di layar kunci API di dasbor Anda, di sebelah kunci itu sendiri. Itu adalah ID yang sama dalam setiap panggilan yang Anda buat.

Coba

Ganti apa pun di dalam tanda kurung sudut dengan nilai Anda sendiri, dan placeholder kunci dengan kunci dari dasbor Anda.

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[]> }'

Sudah masuk? Konsol API di dasbor Anda akan mengisi ID organisasi asli dan kunci Anda sendiri, serta menjalankan permintaan terhadap API langsung sehingga Anda dapat melihat respons aktualnya. Buka titik akhir ini di konsol API

Detail

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`.

Parameter

NamaJenisWajibTentang apa ini
survey_id (path)stringYa

Isi permintaan

NamaJenisWajibTentang apa ini
org_idstringTidak
distinct_idstringTidakThe 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.
pathstringTidak
answersSurveyAnswer[]Ya

Tanggapan

NamaJenisWajibTentang apa ini
recordedbooleanYa
duplicatebooleanYaTrue 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…
idstringTidak

Kesalahan yang dapat dikembalikan oleh titik akhir ini

401 · 403 · 404 · 422