Track a User Journey
Flow Example for Fill Form
After user scan QR on digital dignage and being redirected to your form, we expect you to send updates to SR server after each step, e.g.
FORM_SUBMITTED -> FORM_REVIEWING -> FORM_APPROVED
Then, you issue a coupon to user using "Issue Coupon" endpoint
API Documentation for this endpoint
Endpoint Path
POST <BASE_URL>/smart-engage/post/update-session-status
Request Parameters
Type | Name | Required | Example Value |
---|---|---|---|
Request Body | session_id | Yes | 8960569d-db50-4742-8668-1da5c8ddf652 |
Request Body | new_status | Yes | FORM_REVIEWING |
Request Body
{
"session_id": "8960569d-db50-4742-8668-1da5c8ddf652",
"new_status": "FORM_REVIEWING"
}
Response Status
Status Code | Meaning |
---|---|
200 | Success |
400 | Bad Request |
401 | Unauthorized |
404 | Not Found |
500 | Internal Server Error |
Response Body
- Success
- Bad Request
- Unauthorized
- Not Found
- Internal Server Error
{
"message": "Status updated successfully"
}
{
"error_msg": "Action already completed for session_id: 8960569d-db50-4742-8668-1da5c8ddf652"
}
{
"error_msg": "API-KEY is invalid"
}
{
"error_msg": "No record with session_id: 8960569d-db50-4742-8668-1da5c8ddf652"
}
{
"error_msg": "Internal error occured, please check with our team"
}
Code Example to Request the Endpoint
- cURL
- Python
- PHP
curl -X POST "<BASE_URL>/smart-engage/post/update-session-status" \
-H "Content-Type: application/json" \
-H "API-KEY: <YOUR_API_KEY>" \
-d '{
"session_id": "8960569d-db50-4742-8668-1da5c8ddf652",
"new_status": "FORM_REVIEWING"
}'
import requests
url = "<BASE_URL>/smart-engage/post/update-session-status"
headers = {
"Content-Type": "application/json",
"API-KEY": "<YOUR_API_KEY>"
}
data = {
"session_id": "8960569d-db50-4742-8668-1da5c8ddf652",
"new_status": "FORM_REVIEWING"
}
response = requests.post(url, json=data, headers=headers)
print(response.json())
<?php
$url = "<BASE_URL>/smart-engage/post/update-session-status";
$data = array(
"session_id" => "8960569d-db50-4742-8668-1da5c8ddf652",
"new_status" => "FORM_REVIEWING"
);
$headers = array(
"Content-Type: application/json",
"API-KEY: <YOUR_API_KEY>"
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // to capture response as a string
curl_setopt($ch, CURLOPT_POST, true); // use POST method
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); // attach JSON body
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // set headers
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Request Error: ' . curl_error($ch);
} else {
$responseData = json_decode($response, true);
print_r($responseData); // print decoded JSON response
}
curl_close($ch);
?>