Surveys & Results
Surveys determine when a certain question is used and how the collected feedback is displayed. The results are available via the survey
resource.
Summary of available resource patterns
Code | URL |
---|---|
GET | /v1/surveys/:key |
GET | /v1/surveys/:key/results |
GET | /v1/surveys/:key/openfeedback |
GET | /v1/surveys/:key/followup |
GET | /v1/surveys/:key/rawresults |
Survey
JSON presentation of survey.
Properties
Name | Description |
---|---|
key | The identifier of the survey |
question | Object of the question in default locale. |
folder | Object of the folder where survey is located. |
timeZone | The time zone of survey in “Area/Location”-format. |
activePeriods | An array of objects with two properties, start and end, describing time periods when the survey is active. Start timestamp is inclusive and end is exclusive. If survey does not have any periods, this property is not included. |
surveyType | A string representing the survey’s type. Possible values are: TERMINAL , TABLET and WEB . surveyType is TERMINAL for surveys collecting feedback using Smiley Terminals, TABLET for surveys collecting feedback using Smiley Touch and WEB for surveys collecting feedback using Smiley Digital. |
indexType1 | A string representing the index type. Possible values currently are: HAPPY , NPS or AVERAGE . |
feedbackScale1 | A string representing the feedback scale. Possible values currently are: FOUR , FIVE or FIVE_REVERSED . |
1 Some values require a premium feature to be enabled for account.
Example JSON objects
Survey with two active periods.
OpenFeedback
JSON presentation of open feedback.
Properties
Name | Description |
---|---|
ts | Timestamp in survey time zone |
r | Index . Smiley button used when feedback was given. Number from 0 (Very Unhappy) to 3 (Very Happy) for 4 scale and from 0 (Very Unhappy) to 4 (Very Happy) for 5 scale. |
relevance | optional Float from 0.0 (worst) to 1.0 (best). Automatically analyzed quality value for the open feedback text. |
spam | optional , true or false . true if feedback is marked as spam. |
f | Optional, FollowUp object. The follow-up that was chosen when feedback was given. Will not be present if follow-ups are disabled, user did not choose any or if device does not support them. |
text | The open feedback text |
Example JSON objects
Positive feedback given after pressing the green button and choosing a follow-up
Negative feedback given after pressing the red button and choosing a follow-up
Negative feedback given after pressing the red button without choosing a follow-up
Feedback categorized as spam
FollowUp
JSON presentation of follow-up option.
Properties
Name | Description |
---|---|
key | Unique id of the follow-up option |
name | Follow-up text in question’s default locale |
Example JSON objects
FollowUpResult
JSON presentation of follow-up option results.
FollowUp object appended with results:
Properties
Name | Description |
---|---|
data | Responses. An array indexed from Very Unhappy (red button, index 0) to Very Happy (green button, index 3) for 4 scale and from Very Unhappy (red button, index 0) to Very Happy (green button, index 4) for five scale |
percentages | Relative amount compared to other follow-ups during the requested time period. Percentages are calculated separately for highlights and pain points. |
Example JSON objects
RawResult
JSON presentation of raw result.
FollowUp object appended with results:
Properties
Name | Description |
---|---|
ts | Timestamp in survey time zone |
r | optional index. Smiley button used when feedback was given. Number from 0 (Very Unhappy) to 3 (Very Happy) for 4 scale and from 0 (Very Unhappy) to 4 (Very Happy) for 5 scale. Not present for older Smiley Digital open feedback, see the o property below for more info. |
data | optional index array. Alternative to r . Hourly summed up results. The indexes in the array run from 0 (Very Unhappy) to 3 (Very Happy) for 4 scale and from 0 (Very Unhappy) to 4 (Very Happy) for 5 scale. See more when this is returned under /v1/surveys/:key/rawresults |
f | optional FollowUp object. The follow-up that was chosen when feedback was given, if any. |
o | optional Partial OpenFeedback object. Always includes the Newer (after March 2020) Smiley Digital feedback consists of both button response and open feedback and is returned as one standard raw result that has only the root level |
Example JSON objects
Basic raw result
Hourly summed raw result
Raw result with follow-up
Raw result with follow-up and open feedback
Raw result with open feedback
Prior March 2020 raw open feedback result from Smiley Digital
GET
/v1/surveys/:key
Retrieves information for a specific survey.
Parameters
Name | Description |
---|---|
key | required, identifier of the survey |
Example requests and responses
GET
/v1/surveys/1
Result
Name | Description |
---|---|
Success | Survey |
Error | HTTP status code 404 when no survey is found. |
GET
/v1/surveys/:key/results
Retrieves feedback results for specific survey.
Parameters
Name | Description |
---|---|
key | required, identifier of the survey |
date_start | optional , timestamp Timestamp of returned feedback data is equal or later than the value. When precision is day or greater then
|
date_end | optional , timestamp Timestamp of returned feedback data is sooner than the value. For default values, see |
truncate | optional , year | month | week | day | hour Case-insensitive value from one of the above. Truncates and sums the feedback to required precision. By default it is |
Example requests and responses
Result
Name | Description |
---|---|
Success | Array of objects with ts for result timestamp and data for array of feedback. The array is indexed from Very Unhappy (red button, index 0) to Very Happy (green button, index 3) for 4 scale and from Very Unhappy (red button, index 0) to Very Happy (green button, index 4) for 5 scale. The actual indexes are dependent on how many active buttons the device has. |
Error | HTTP status code 400 when date_end is before date_start or unknown value given for truncate . HTTP status code 404 when no survey is found. |
GET
/v1/surveys/:key/openfeedback
Retrieves open feedback for specific survey.
Parameters
Name | Description |
---|---|
key | required, identifier of the survey |
date_start | optional , timestamp Timestamp of returned survey open feedback data is equal or later than the value. |
date_end | optional , timestamp Timestamp of returned open feedback data is sooner than the value. |
Example requests and responses
Result
Name | Description |
---|---|
Success | A single JSON object that contains meta and data keys. The data key contains an array of OpenFeedback objects. The meta key contains paging information, if the response does not contain all the results. If there is so much feedback that some of it does not fit in the same HTTP response, the response will contain the feedback with the earliest timestamps. The maximum amount of open feedback returned in single response is 10 000. If there is more feedback available, then inside the |
Error | HTTP status code 400 in case of invalid parameters. HTTP status code 404 when no survey is found. |
GET
/v1/surveys/:key/followup
Retrieves follow-up results for a specific survey.
Parameters
Name | Description |
---|---|
key | required, identifier of the survey |
date_start | optional , timestamp Timestamp of returned survey follow-up result data is equal or later than the value. |
date_end | optional , timestamp Timestamp of returned follow-up result data is sooner than the value. |
Example requests and responses
Result
Name | Description |
---|---|
Success | Object containing two properties: meta for any additional information and data for the follow-up results.
Each array item is a FollowUpResult object In the case where no follow-up responses were given during the requested period, empty |
Error | HTTP status code 400 in case of invalid parameters. HTTP status code 404 when no survey is found. |
GET
/v1/surveys/:key/rawresults
Retrieves raw feedback results for a specific survey.
Description
It is possible to get raw results instead of summed up results. Raw results have a separate timestamp for each feedback. This allows getting the time of the feedback as accurately as possible. Raw data does not use the misuse filtering that the normal results use: if you compare the raw results to the normal results, they will not exactly match.
Most terminals are able to report the time of feedback at the accuracy of one second. Some Smiley Terminals can only report results summed up by the hour due to more limited technical capabilities or poor local network connectivity.
Also, in some situations some older devices might need to batch multiple results to the same timestamp, therefore it is possible that in some conditions there are multiple results that appear to be exactly the same, but are actually separate button presses given inside a short time period.
The accurate raw results are returned in JSON Objects like this:
The Object represents one feedback. The individual response is returned as a number from 0 (Very Unhappy) to 3 (Very Happy) for 4 scale and from 0 (Very Unhappy) to 4 (Very Happy) for 5 scale.
The hourly summed up results are returned in a JSON Object like this:
The four numbers in the array are the counts of four types of feedback on a Smiley Terminal for 4 scale. The indexes in the array run from 0 (Very Unhappy) to 3 (Very Happy) for 4 scale.
The five numbers in the array are the counts of five types of feedback on all types of devices, except Smiley Terminal, for 5 scale. The indexes in the array run from 0 (Very Unhappy) to 4 (Very Happy).
The response from this endpoint may contain both types of data objects in the same array of results returned.
If your terminals are not reporting the feedback times with sufficient accuracy, please contact HappyOrNot support or your HappyOrNot sales contact to see what can be done.
Parameters
Name | Description |
---|---|
key | required, identifier of the survey |
date_start | optional , timestamp Timestamp of returned feedback data is equal or later than the value. If the parameter is not present, data is returned from the beginning. |
date_end | optional , timestamp Timestamp of returned feedback data is sooner than the value. If the parameter is not present, data is returned to the end. |
followup | optional , boolean If |
openfeedback | optional , boolean If |
Example requests and responses
Result
Name | Description |
---|---|
Success | A single JSON object that contains meta and data keys. The data key contains an array of RawResult objects. The meta key contains paging information, if the response does not contain all the results. If there is so much feedback that some of it does not fit in the same HTTP response, the response will contain the feedback with the earliest timestamps. The maximum amount of feedback returned in a single response will vary, but should always be over 100 000 if results do not contain any open feedback. If open feedback is requested, the amount of feedback returned in a single response is limited to 10 000. Inside the |
Error | Empty result data array when date_end is before date_start or if the dates are the same. HTTP status code 404 when no survey is found. |