Skip to content

SonaGetPrescreenSurveyDataByDateRange

Description

This API retrieves the list of prescreen or survey responses, for multiple participants, based on a given date range.

Input Parameters

Below are the following input parameters for use with the SonaGetPrescreenSurveyDataByDateRange API function.

Parameter Description / Possible Values
api_key Use API key generated for Sona admin user
experiment_id The experiment_id of the study. Pass in 0 for the prescreen.
start_date The start date of the date range to include. Date must be formatted as: YYYY-MM-DD. This date is based on when the participant completed the prescreen or online survey.
end_date The end date of the date range to include. Date must be formatted as: YYYY-MM-DD. This date is based on when the participant completed the prescreen or online survey.

Output Parameters

Will return APIPrescreenSurveyData class and display data in an array.

Error Codes

Below are the possible error messages encountered and their respective descriptions.

Error Type Error Code Description
Authentication Failed -1 through -7 Standard authentication errors
Error Code -8 no prescreen nor survey found for the specified experiment_id
Error Code -9 No completed prescreen or survey responses were found in the selected date range.
Error Code -10 invalid start date
Error Code -11 invalid end date
Error Code -12 start date is greater than end date
Error Code -14 experiment_id is not found/invalid

Sample Input

Request URL

https://myschool.sona-systems.com/services/SonaAPI.svc/SonaGetPrescreenSurveyDataByDateRange?api_key=YOUR_API_KEY&experiment_id=0&start_date=2013-01-01&end_date=2013-12-31

URL components

Component Value
Scheme https
Host myschool.sona-systems.com
Service path /services/SonaAPI.svc
Function SonaGetPrescreenSurveyDataByDateRange

Query parameters

api_key = YOUR_API_KEY
experiment_id = 0
start_date = 2013-01-01
end_date = 2013-12-31

Sample Output

<SonaGetPrescreenSurveyDataByDateRangeResponse
  xmlns="https://www.sona-systems.com/"
  xmlns:a="http://schemas.datacontract.org/2004/07/emsdotnet.sonasystems"
  xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <SonaGetPrescreenSurveyDataByDateRangeResult>
    <a:Errors i:nil="true" />
    <a:Result>
      <a:APIPrescreenSurveyData>
        <a:anon_id_code />
        <a:data_status>S</a:data_status>
        <a:end_time>2013-04-24T15:28:58</a:end_time>
        <a:first_name>Frank</a:first_name>
        <a:last_name>Bass</a:last_name>
        <a:person_id>9394</a:person_id>
        <a:pretest_id>10</a:pretest_id>
        <a:responses>
          <a:APIPrescreenSurveyResponseItem>
            <a:choice_id>57</a:choice_id>
            <a:opt_out_choice>0</a:opt_out_choice>
            <a:question_id>17</a:question_id>
            <a:response_id>1005</a:response_id>
            <a:response_numeric>0</a:response_numeric>
            <a:response_text>külm</a:response_text>
          </a:APIPrescreenSurveyResponseItem>
          <a:APIPrescreenSurveyResponseItem>
            <a:choice_id>129</a:choice_id>
            <a:opt_out_choice>1</a:opt_out_choice>
            <a:question_id>27</a:question_id>
            <a:response_id>1006</a:response_id>
            <a:response_numeric>0</a:response_numeric>
            <a:response_text>[Decline to Answer]</a:response_text>
          </a:APIPrescreenSurveyResponseItem>
          <a:APIPrescreenSurveyResponseItem>
            <a:choice_id>145</a:choice_id>
            <a:opt_out_choice>1</a:opt_out_choice>
            <a:question_id>32</a:question_id>
            <a:response_id>1007</a:response_id>
            <a:response_numeric>0</a:response_numeric>
            <a:response_text>[Decline to Answer]</a:response_text>
          </a:APIPrescreenSurveyResponseItem>
        </a:responses>
        <a:start_time>2013-04-24T15:28:45</a:start_time>
        <a:status>C</a:status>
        <a:user_id>bass</a:user_id>
      </a:APIPrescreenSurveyData>
      <a:APIPrescreenSurveyData>
        <a:anon_id_code />
        <a:data_status>S</a:data_status>
        <a:end_time>2013-04-29T23:31:55</a:end_time>
        <a:first_name>Greg</a:first_name>
        <a:last_name>Smith</a:last_name>
        <a:person_id>9308</a:person_id>
        <a:pretest_id>10</a:pretest_id>
        <a:responses>
          <a:APIPrescreenSurveyResponseItem>
            <a:choice_id>57</a:choice_id>
            <a:opt_out_choice>0</a:opt_out_choice>
            <a:question_id>17</a:question_id>
            <a:response_id>1010</a:response_id>
            <a:response_numeric>0</a:response_numeric>
            <a:response_text>külm</a:response_text>
          </a:APIPrescreenSurveyResponseItem>
          <a:APIPrescreenSurveyResponseItem>
            <a:choice_id>130</a:choice_id>
            <a:opt_out_choice>0</a:opt_out_choice>
            <a:question_id>27</a:question_id>
            <a:response_id>1011</a:response_id>
            <a:response_numeric>1</a:response_numeric>
            <a:response_text>Yes</a:response_text>
          </a:APIPrescreenSurveyResponseItem>
          <a:APIPrescreenSurveyResponseItem>
            <a:choice_id>146</a:choice_id>
            <a:opt_out_choice>0</a:opt_out_choice>
            <a:question_id>32</a:question_id>
            <a:response_id>1012</a:response_id>
            <a:response_numeric>2</a:response_numeric>
            <a:response_text>No</a:response_text>
          </a:APIPrescreenSurveyResponseItem>
        </a:responses>
        <a:start_time>2013-04-29T23:31:38</a:start_time>
        <a:status>C</a:status>
        <a:user_id>smithg</a:user_id>
      </a:APIPrescreenSurveyData>
    </a:Result>
  </SonaGetPrescreenSurveyDataByDateRangeResult>
</SonaGetPrescreenSurveyDataByDateRangeResponse>