Skip to content

SonaSetCoursesByPersonID

Description

This API allows overwriting or removing the course assignments for a participant specified by person_id.

Input Parameters

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

Parameter Description / Possible Values
api_key Use API key generated for Sona admin user
person_id The person_id to set courses for
class_ids Comma-separated list of course IDs to assign to the participant. E.g. 42,67,1337
Specify a single class_id of 0 to remove all course assignments for that participant.

Credit Assignment Note: If course credit assignment is enabled for your site, credits assigned to removed courses are handled as follows:

If you provide exactly one course, credits from removed courses are reassigned to that course. Any previously unassigned non-zero credits are also assigned to it.

If you provide more than one course, credits from removed courses will be unassigned.

Output Parameters

Will return True if course assignment was successful, or errors if unsuccessful.

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 courses chosen. You must choose at least one course.
Error Code -10 person_id is invalid or does not identify a participant, or no valid course IDs were supplied.

Sample Input

Request URL

https://myschool.sona-systems.com/services/SonaAPI.svc/SonaSetCoursesByPersonID?api_key=YOUR_API_KEY&person_id=1234&class_ids=42,67,1337

URL components

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

Query parameters

api_key = YOUR_API_KEY
person_id = 1234
class_ids = 42,67,1337

Sample Output

<SonaSetCoursesByPersonIDResponse
  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">
  <SonaSetCoursesByPersonIDResult>
    <a:Errors i:nil="true" />
    <a:Result>true</a:Result>
  </SonaSetCoursesByPersonIDResult>
</SonaSetCoursesByPersonIDResponse>