surveys
POST /v1/surveys/{survey_id}/responses
Record one person's answers to one survey.
تصدیقهویت
یو API کی د بیئرر ټوکن (bearer token) په توګه ولیکئ. کی باید د org.read اجازه ولري؛ له دې اجازې پرته کی د 404 پرځای د 403 په واسطه رد کیږي.
چیرته چې ستاسو د سازمان آی ډي ځي
دا پای ټکی د JSON په متن کې د یوې ساحې په توګه org_id اخلي.
ستاسو د سازمان آی ډي ستاسو په ډشبورډ کې د API کېلي پر سکرین، خپله د کېلي څنګ ته شتون لري. دا په هره هغه غوښتنه کې چې تاسو یې کوئ، ورته آی ډي وي.
هڅه وکړئ
د انګلیسي په زاوي پنسونو کې هرڅه د خپلو ارزښتونو سره بدل کړئ، او د کلي ځای لرونکی ستاسو د ډشبورډ د کلي سره.
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[]> }'ننوتي یاست؟ ستاسو په ډشبورډ کې د API کنسول ستاسو د اصلي سازمان ID او ستاسو خپله کیلي ډکوي، او غوښتنه د ژوندی API په وړاندې پرمخ وړي ترڅو تاسو وکولی شئ اصلي ځواب وګورئ. دا پای ټکی (endpoint) د API په کنسول کې پرانیزئ
تفصیلات
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`.
پارامترونه
| نوم | ډول | اړین | دا څه شی دی |
|---|---|---|---|
survey_id (path) | string | هو | — |
د غوښتنې بدن
| نوم | ډول | اړین | دا څه شی دی |
|---|---|---|---|
org_id | string | نه | — |
distinct_id | string | نه | 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 | نه | — |
answers | SurveyAnswer[] | هو | — |
ځواب
| نوم | ډول | اړین | دا څه شی دی |
|---|---|---|---|
recorded | boolean | هو | — |
duplicate | boolean | هو | 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 | نه | — |
تېروتنې چې دا پای ټکی یې بیرته راګرځولی شي
401 · 403 · 404 · 422