« Back to Documentation Overview

get_survey_stats

Section: Surveys
Version: 1.5.0


Get message statistics with summarized amount of every choices.
Conditions:

  • survey (mandatory) – SURVEY_ID, may be obtained from get_surveys.
  • anonymous (optional) – Allowed values are true and false. Survey may be filled by contact (for example when it was sent by email and CONTACT_ID is known) or by anonymous visitor (for example when survey is linked on www page). When this param is skipped all responses are counted without distinguishing who filled the survey.M

Questions that do not have predetermined answers (text fields) have total amount of responses returned while questions with predetermined answers (single/multi selects) have amount of responses for every option returned.

Meaning of every QUESTION_ID and OPTION_ID can be found by calling get_surveys method.


Parameters
stringAPI_KEY
object
stringsurveySURVEY_ID
booleananonymous1
Return Value
objectQUESTION_ID
integerOPTION_ID4

Example Request JSON

[
    "API_KEY",
    {
        "survey": "SURVEY_ID",
        "anonymous": true
    }
]

Example Response JSON

{
    "QUESTION_ID": {
        "OPTION_ID": 4
    }
}

Example Error Response JSON

{
    "code": -1,
    "message": "Missing survey"
}
Method-specific Errors
Missing survey
API-wide Errors
API key verification failed API key verification failed
API client IP not allowed API client IP not allowed
Invalid params Attribute params must be reference to hash