Skip to content

SonaGetStudyStatsByDateRange

Description

This API retrieves basic usage information for a particular study, within a given date range. It’s similar to the Timeslot Usage Summary in the web interface.

Input Parameters

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

Parameter Description / Possible Values
api_key Use API key generated for Sona admin user
experiment_id The experiment_id of the study. For multi-part studies, specify the experiment_id of the first part; results will be based on all parts of the study.
start_date Date to use for beginning of listing. Date must be formatted as: YYYY-MM-DD.
end_date Date to use for end of listing. Date must be formatted as: YYYY-MM-DD.

Output Parameters

Will return a single APIStudyStats result.

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 Not supplied not a valid experiment_id
Error Code Not supplied start_date is not a valid date or is not properly formatted (must be YYYY-MM-DD)
Error Code Not supplied end_date is not a valid date or is not properly formatted (must be YYYY-MM-DD)
Error Code Not supplied start_date must the same as or earlier than end_date

Sample Input

Request URL

https://myschool.sona-systems.com/services/SonaAPI.svc/SonaGetStudyStatsByDateRange?api_key=YOUR_API_KEY&experiment_id=4&start_date=2016-01-01&end_date=2016-12-31

URL components

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

Query parameters

api_key = YOUR_API_KEY
experiment_id = 4
start_date = 2016-01-01
end_date = 2016-12-31

Sample Output

<SonaGetStudyStatsByDateRangeResponse
  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">
  <SonaGetStudyStatsByDateRangeResult>
    <a:Errors i:nil="true" />
    <a:Result>
      <a:awaiting_action_count>0</a:awaiting_action_count>
      <a:credits_granted_total>7.00</a:credits_granted_total>
      <a:experiment_id>4</a:experiment_id>
      <a:noshow_count>0</a:noshow_count>
      <a:noshow_excused_count>0</a:noshow_excused_count>
      <a:noshow_unexcused_count>0</a:noshow_unexcused_count>
      <a:open_spaces_future>0</a:open_spaces_future>
      <a:open_spaces_past>10</a:open_spaces_past>
      <a:participated_count>5</a:participated_count>
      <a:study_name>A Study On Dreams</a:study_name>
      <a:timeslot_count>3</a:timeslot_count>
    </a:Result>
  </SonaGetStudyStatsByDateRangeResult>
</SonaGetStudyStatsByDateRangeResponse>