Skip to content

SonaGetStudyScheduleList

Description

This API retrieves the list of studies within a given date range. It basically mimics the Study Schedule Report as found in the Generate Reports page of the main site.

Input Parameters

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

Parameter Description / Possible Values
api_key Use API key generated for Sona admin user
location_id Allowed values:
-2: All locations
-1: All locations with no resource IDs
0: All locations with resource IDs
> 0: Specific resource ID

A resource_id exists if the location was selected from the list configured in Location Listings.
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.
lab_only Possible values are as follows: 1 = only standard studies | 0 = all studies.

Output Parameters

Returns an array of APIStudySchedule records. If no records match the request, Errors contains No records found. and Result is not populated.

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 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 be earlier than end_date
Error Code Not supplied location_id must be numeric
Error Code Not supplied lab_only must be numeric
Error Code Not supplied No records match the supplied filters.

Sample Input

Request URL

https://myschool.sona-systems.com/services/SonaAPI.svc/SonaGetStudyScheduleList?api_key=YOUR_API_KEY&location_id=-2&start_date=2012-01-03&end_date=2012-01-10&lab_only=1

URL components

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

Query parameters

api_key = YOUR_API_KEY
location_id = -2
start_date = 2012-01-03
end_date = 2012-01-10
lab_only = 1

Sample Output

<SonaGetStudyScheduleListResponse
  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">
  <SonaGetStudyScheduleListResult>
    <a:Errors i:nil="true" />
    <a:Result>
      <a:APIStudySchedule>
        <a:duration>30</a:duration>
        <a:experiment_id>11</a:experiment_id>
        <a:location>LAB 01</a:location>
        <a:num_signed_up>5</a:num_signed_up>
        <a:num_students>10</a:num_students>
        <a:researcher_id>9311</a:researcher_id>
        <a:study_name>Study Name 1</a:study_name>
        <a:survey_flag>0</a:survey_flag>
        <a:timeslot_date>2012-01-05T15:00:00</a:timeslot_date>
        <a:timeslot_id>67</a:timeslot_id>
        <a:videoconf_flag>1</a:videoconf_flag>
        <a:videoconf_url>https://www.zoom.com/123</a:videoconf_url>
        <a:web_flag>0</a:web_flag>
      </a:APIStudySchedule>
      <a:APIStudySchedule>
        <a:duration>30</a:duration>
        <a:experiment_id>12</a:experiment_id>
        <a:location>LAB 02</a:location>
        <a:num_signed_up>3</a:num_signed_up>
        <a:num_students>3</a:num_students>
        <a:researcher_id>9312</a:researcher_id>
        <a:study_name>Study Name 2</a:study_name>
        <a:survey_flag>0</a:survey_flag>
        <a:timeslot_date>2012-01-06T15:00:00</a:timeslot_date>
        <a:timeslot_id>68</a:timeslot_id>
        <a:videoconf_flag>1</a:videoconf_flag>
        <a:videoconf_url>https://www.zoom.com/123</a:videoconf_url>
        <a:web_flag>0</a:web_flag>
      </a:APIStudySchedule>
    </a:Result>
  </SonaGetStudyScheduleListResult>
</SonaGetStudyScheduleListResponse>