surveys

POST /v1/surveys/{survey_id}/responses

Record one person's answers to one survey.

Бүх surveys төгсгөлийн цэгүүд

Баталгаажуулалт

API түлхүүрийг bearer token хэлбэрээр илгөэнэ үү. Түлхүүр нь org.read эрхтэй байх ёстой бөгөөд үүнгүйгээр 404 биш, харин 403 алдаа буцааж татгалзах болно.

Таны байгууллагын дугаар орох газар

Энэ төгсгөлийн цэг нь JSON бие хэсэгт org_id-ийг талбар болгон авдаг.

Танай байгууллагын ID нь таны хяналтын самбар дээрх API түлхүүрийн дэлгэцэнд, түлхүүр өөрөө хажууд байрладаг. Энэ нь таны хийх дуудлага бүрт ижил ID байна.

Туршиж үзэх

Өнцөг хаалтанд байгаа бүх зүйлийг өөрийн утгаар солиж, түлхүүр санамж байрлуулагчийг хяналтын самбарынхаа түлхүүрээр сольж оруулна уу.

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 рүү хүсэлт илгээх тул та бодит хариуг харах боломжтой болно. Энэ төгсгөлийн цэгийг 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_idstringҮгүй
distinct_idstringҮгүй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.
pathstringҮгүй
answersSurveyAnswer[]Тийм

Хариу үйлдэл

НэрТөрөлЗаавал шаардлагатайЭнэ юу вэ
recordedbooleanТийм
duplicatebooleanТийм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…
idstringҮгүй

Энэ төгсгөл цэгээс буцааж болох алдаанууд

401 · 403 · 404 · 422