First example
Ask two people how their visit went, with one link and no signup.
On this page
1. Ask
You need curl and jq. Set the API address, and make new files readable only by you, since one of them will hold the trial key:
export SESS_API="https://api.sess.si"
umask 077
cat > visit.json <<'JSON'
{
"interaction": {
"mode": "interactive",
"title": "How was your visit?",
"source": {
"kind": "sess_surface",
"components": [
{
"type": "field",
"name": "visit",
"label": "Your visit",
"required": true,
"rating": { "low": "Poor", "high": "Great" },
"schema": { "type": "integer", "minimum": 1, "maximum": 5 }
},
{
"type": "field",
"name": "comment",
"label": "Anything else?",
"multiline": true,
"schema": { "type": "string", "maxLength": 500 }
}
]
},
"actions": [{ "id": "submit", "label": "Send", "intent": "submit" }]
},
"respondents": { "max": 2 }
}
JSON
curl -sS -X POST "$SESS_API/v1/trial/asks" \
-H "Content-Type: application/json" \
--data-binary @visit.json \
-o ask.json -w '%{http_code}\n'
export ASK_ID="$(jq -r .id ask.json)"
export SESS_TRIAL_KEY="$(jq -r .management_credential ask.json)"
jq -r .human_url ask.json
Expected result: 201, then the link. ask.json holds the trial key, shown once. Keep it secret.
2. Answer twice
Open the link on your phone and answer. Then open it on this computer and answer again. Each browser gets its own page.
3. Read both answers
curl -sS "$SESS_API/v1/trial/asks/$ASK_ID" \
-H "Authorization: Bearer $SESS_TRIAL_KEY" \
| jq -c '[.sessions[].responses[].data]'
[{"visit":5,"comment":"Lovely staff."},{"visit":4}]
A trial Ask is for at most 2 people. Creating it and each person's start count toward your network's 3 trials a day; see Limits.
With an API key, the same Ask takes up to your plan's limit: see the Quickstart.