Saylor Academy API logo Saylor Academy API

Getting Started

Welcome!

This API document is designed for those interested in programatically getting more information from the Saylor Academy platform.

This API is still under development and will evolve.

You’ll succeed if you do this.

Here’s some useful information.

Something may not happen if you try and do this.

Something bad will happen if you do this.

Authentication

You need to be authenticated and supply a token for all API requests. You will either receive this API token from us directly or be able to generate one within your profile, depending on which API is used. Please refer to the specific API section for instructions on how to get the token for that API.

Nothing will work unless you include the API token

Add the API token to all requests as a query string called ‘wstoken’. Send a POST request to https://learn.saylor.org/webservice/rest/server.php. Any function parameters can be appended to the query string.

If you’d like the response to be JSON instead of XML, add “&moodlewsrestformat=json” to the query string.

curl -X POST https://learn.saylor.org/webservice/rest/server.php --data "wstoken=YOUR_API_TOKEN&wsfunction=YOUR_FUNCTION_NAME&YOUR_FUNCTION_PARAMETERS=YOUR_FUNCTION_VALUES" -v

Program Partner

API for program partners to access information about their students.

This API service offers information for program partners to access information about their students - and only students present within their cohort.

Functions

If you are a program partner, Saylor Academy will create an access token for you and send you the access token and cohort ID.

core_completion_get_course_activities_completion_status

Return the activities completion status for a user in a course.

Parameters
courseid (Required)
Course ID
userid (Required)
User’s ID
General structure

int   //Course ID
General structure

int   //User ID

This function will return the completion status for all activities for the specified user in the specified course.

The ‘timecompleted’ field that is returned for the activities can be used to determine a user’s progress through the course.

General structure

object {
statuses   //List of activities status
list of ( 
  //Activity
object {
cmid int   //comment ID
modname string   //activity module name
instance int   //instance ID
state int   //completion state value:
                                                                    0 means incomplete, 1 complete,
                                                                    2 complete pass, 3 complete fail
timecompleted int   //timestamp for completed activity
tracking int   //type of tracking:
                                                                    0 means none, 1 manual, 2 automatic
} 
)warnings  Optional //list of warnings
list of ( 
  //warning
object {
item string  Optional //item
itemid int  Optional //item id
warningcode string   //the warning code can be used by the client app to implement specific behaviour
message string   //untranslated english message to explain the warning
} 
)} 
<?xml version="1.0" encoding="UTF-8" ?>
<RESPONSE>
    <SINGLE>
        <KEY name="statuses">
            <MULTIPLE>
                <SINGLE>
                    <KEY name="cmid">
                        <VALUE>int</VALUE>
                    </KEY>
                    <KEY name="modname">
                        <VALUE>string</VALUE>
                    </KEY>
                    <KEY name="instance">
                        <VALUE>int</VALUE>
                    </KEY>
                    <KEY name="state">
                        <VALUE>int</VALUE>
                    </KEY>
                    <KEY name="timecompleted">
                        <VALUE>int</VALUE>
                    </KEY>
                    <KEY name="tracking">
                        <VALUE>int</VALUE>
                    </KEY>
                </SINGLE>
            </MULTIPLE>
        </KEY>
        <KEY name="warnings">
            <MULTIPLE>
                <SINGLE>
                    <KEY name="item">
                        <VALUE>string</VALUE>
                    </KEY>
                    <KEY name="itemid">
                        <VALUE>int</VALUE>
                    </KEY>
                    <KEY name="warningcode">
                        <VALUE>string</VALUE>
                    </KEY>
                    <KEY name="message">
                        <VALUE>string</VALUE>
                    </KEY>
                </SINGLE>
            </MULTIPLE>
        </KEY>
    </SINGLE>
</RESPONSE>
<?xml version="1.0" encoding="UTF-8"?>
<EXCEPTION class="invalid_parameter_exception">
    <MESSAGE>Invalid parameter value detected</MESSAGE>
    <DEBUGINFO></DEBUGINFO>
</EXCEPTION>

core_completion_get_course_completion_status

Returns course completion status.

Parameters
courseid (Required)
Course ID
userid (Required)
User’s ID
General structure

int   //Course ID
General structure

int   //User ID
General structure

  //Course completion status
object {
completionstatus   //Course status
object {
completed int   //true if the course is complete, false otherwise
aggregation int   //aggregation method 1 means all, 2 means any
completions list of ( 
  //Completions
object {
type int   //Completion criteria type
title string   //Completion criteria Title
status string   //Completion status (Yes/No) a % or number
complete int   //Completion status (true/false)
timecompleted int   //Timestamp for criteria completetion
details   //details
object {
type string   //Type description
criteria string   //Criteria description
requirement string   //Requirement description
status string   //Status description, can be anything
} 
} 
)} 
warnings  Optional //list of warnings
list of ( 
  //warning
object {
item string  Optional //item
itemid int  Optional //item id
warningcode string   //the warning code can be used by the client app to implement specific behaviour
message string   //untranslated english message to explain the warning
} 
)} 
<?xml version="1.0" encoding="UTF-8" ?>
<RESPONSE>
    <SINGLE>
        <KEY name="completionstatus">
            <SINGLE>
                <KEY name="completed">
                    <VALUE>int</VALUE>
                </KEY>
                <KEY name="aggregation">
                    <VALUE>int</VALUE>
                </KEY>
                <KEY name="completions">
                    <MULTIPLE>
                        <SINGLE>
                            <KEY name="type">
                                <VALUE>int</VALUE>
                            </KEY>
                            <KEY name="title">
                                <VALUE>string</VALUE>
                            </KEY>
                            <KEY name="status">
                                <VALUE>string</VALUE>
                            </KEY>
                            <KEY name="complete">
                                <VALUE>int</VALUE>
                            </KEY>
                            <KEY name="timecompleted">
                                <VALUE>int</VALUE>
                            </KEY>
                            <KEY name="details">
                                <SINGLE>
                                    <KEY name="type">
                                        <VALUE>string</VALUE>
                                    </KEY>
                                    <KEY name="criteria">
                                        <VALUE>string</VALUE>
                                    </KEY>
                                    <KEY name="requirement">
                                        <VALUE>string</VALUE>
                                    </KEY>
                                    <KEY name="status">
                                        <VALUE>string</VALUE>
                                    </KEY>
                                </SINGLE>
                            </KEY>
                        </SINGLE>
                    </MULTIPLE>
                </KEY>
            </SINGLE>
        </KEY>
        <KEY name="warnings">
            <MULTIPLE>
                <SINGLE>
                    <KEY name="item">
                        <VALUE>string</VALUE>
                    </KEY>
                    <KEY name="itemid">
                        <VALUE>int</VALUE>
                    </KEY>
                    <KEY name="warningcode">
                        <VALUE>string</VALUE>
                    </KEY>
                    <KEY name="message">
                        <VALUE>string</VALUE>
                    </KEY>
                </SINGLE>
            </MULTIPLE>
        </KEY>
    </SINGLE>
</RESPONSE>
<?xml version="1.0" encoding="UTF-8"?>
<EXCEPTION class="invalid_parameter_exception">
    <MESSAGE>Invalid parameter value detected</MESSAGE>
    <DEBUGINFO></DEBUGINFO>
</EXCEPTION>

core_user_get_users_by_field

Retrieve users' information for a specified unique field - If you want to do a user search, use core_user_get_users()

Parameters
field (Required)
the search field can be ‘id’ or ‘idnumber’ or ‘username’ or ‘email’
values (Required)
the values to search for
General structure

string   //the search field can be
                    'id' or 'idnumber' or 'username' or 'email'
General structure

list of ( 
string   //an array of values to match
)

You can get information on specific students in your cohort by searching for the student id (‘id’) or email address (‘email’) for that student.

Information for multiple students can be obtained by suppyling multiple values in the ‘values’ array.

General structure

list of ( 
object {
id int   //ID of the user
username string  Optional //The username
firstname string  Optional //The first name(s) of the user
lastname string  Optional //The family name of the user
fullname string   //The fullname of the user
email string  Optional //An email address - allow email as root@localhost
address string  Optional //Postal address
phone1 string  Optional //Phone 1
phone2 string  Optional //Phone 2
icq string  Optional //icq number
skype string  Optional //skype id
yahoo string  Optional //yahoo id
aim string  Optional //aim id
msn string  Optional //msn number
department string  Optional //department
institution string  Optional //institution
idnumber string  Optional //An arbitrary ID code number perhaps from the institution
interests string  Optional //user interests (separated by commas)
firstaccess int  Optional //first access to the site (0 if never)
lastaccess int  Optional //last access to the site (0 if never)
auth string  Optional //Auth plugins include manual, ldap, imap, etc
confirmed int  Optional //Active user: 1 if confirmed, 0 otherwise
lang string  Optional //Language code such as "en", must exist on server
calendartype string  Optional //Calendar type such as "gregorian", must exist on server
theme string  Optional //Theme name such as "standard", must exist on server
timezone string  Optional //Timezone code such as Australia/Perth, or 99 for default
mailformat int  Optional //Mail format code is 0 for plain text, 1 for HTML etc
description string  Optional //User profile description
descriptionformat int  Optional //int format (1 = HTML, 0 = MOODLE, 2 = PLAIN or 4 = MARKDOWN)
city string  Optional //Home city of the user
url string  Optional //URL of the user
country string  Optional //Home country code of the user, such as AU or CZ
profileimageurlsmall string   //User image profile URL - small version
profileimageurl string   //User image profile URL - big version
customfields  Optional //User custom fields (also known as user profile fields)
list of ( 
object {
type string   //The type of the custom field - text field, checkbox...
value string   //The value of the custom field
name string   //The name of the custom field
shortname string   //The shortname of the custom field - to be able to build the field class in the code
} 
)preferences  Optional //Users preferences
list of ( 
object {
name string   //The name of the preferences
value string   //The value of the custom field
} 
)} 
)
REST

<?xml version="1.0" encoding="UTF-8" ?>
<RESPONSE>
    <MULTIPLE>
        <SINGLE>
            <KEY name="id">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="username">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="firstname">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="lastname">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="fullname">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="email">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="address">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="phone1">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="phone2">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="icq">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="skype">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="yahoo">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="aim">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="msn">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="department">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="institution">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="idnumber">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="interests">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="firstaccess">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="lastaccess">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="auth">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="confirmed">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="lang">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="calendartype">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="theme">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="timezone">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="mailformat">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="description">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="descriptionformat">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="city">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="url">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="country">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="profileimageurlsmall">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="profileimageurl">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="customfields">
                <MULTIPLE>
                    <SINGLE>
                        <KEY name="type">
                            <VALUE>string</VALUE>
                        </KEY>
                        <KEY name="value">
                            <VALUE>string</VALUE>
                        </KEY>
                        <KEY name="name">
                            <VALUE>string</VALUE>
                        </KEY>
                        <KEY name="shortname">
                            <VALUE>string</VALUE>
                        </KEY>
                    </SINGLE>
                </MULTIPLE>
            </KEY>
            <KEY name="preferences">
                <MULTIPLE>
                    <SINGLE>
                        <KEY name="name">
                            <VALUE>string</VALUE>
                        </KEY>
                        <KEY name="value">
                            <VALUE>string</VALUE>
                        </KEY>
                    </SINGLE>
                </MULTIPLE>
            </KEY>
        </SINGLE>
    </MULTIPLE>
</RESPONSE>
<?xml version="1.0" encoding="UTF-8"?>
<EXCEPTION class="invalid_parameter_exception">
    <MESSAGE>Invalid parameter value detected</MESSAGE>
    <DEBUGINFO></DEBUGINFO>
</EXCEPTION>

local_wsfunc_get_grades

Return student course total grade and grades for activities.

Parameters
courseid (Required)
id of course
component (Default to “”)
A component, for example mod_forum or mod_quiz
activityid (Default to “null”)
The activity ID
userids (Default to “Array ( ) “)
An array of user IDs, leave empty to just retrieve grade item information
General structure

int   //id of course
General structure

string  Default to "" //A component, for example mod_forum or mod_quiz
General structure

int  Default to "null" //The activity ID
General structure

 Default to "Array()" //An array of user IDs, leave empty to just retrieve grade item information
list of ( 
int   //user ID
)

This function returns grade information for a specific course or activity in a course.

If no activity ID is specified, grades are returned for the overall course and all activities within that course.

This function returns a “date_submitted” field which can be used to determine the last activity completed within a course and a user’s progress.

General structure

object {
items list of ( 
object {
activityid string   //The ID of the activity or "course" for the course grade item
itemnumber int   //Will be 0 unless the module has multiple grades
scaleid int   //The ID of the custom scale or 0
name string   //The module name
grademin double   //Minimum grade
grademax double   //Maximum grade
gradepass double   //The passing grade threshold
locked int   //0 means not locked, > 1 is a date to lock until
hidden int   //0 means not hidden, > 1 is a date to hide until
grades list of ( 
object {
userid int   //Student ID
grade double   //Student grade
locked int   //0 means not locked, > 1 is a date to lock until
hidden int   //0 means not hidden, 1 hidden, > 1 is a date to hide until
overridden int   //0 means not overridden, > 1 means overridden
feedback string   //Feedback from the grader
feedbackformat int   //The format of the feedback
usermodified int   //The ID of the last user to modify this student grade
datesubmitted int   //A timestamp indicating when the student submitted the activity
dategraded int   //A timestamp indicating when the assignment was grades
str_grade string   //A string representation of the grade
str_long_grade string   //A nicely formatted string representation of the grade
str_feedback string   //A formatted string representation of the feedback from the grader
} 
)} 
)outcomes  Optional //An array of outcomes associated with the grade items
list of ( 
object {
activityid string   //The ID of the activity or "course" for the course grade item
itemnumber int   //Will be 0 unless the module has multiple grades
scaleid int   //The ID of the custom scale or 0
name string   //The module name
locked int   //0 means not locked, > 1 is a date to lock until
hidden int   //0 means not hidden, > 1 is a date to hide until
grades list of ( 
object {
userid int   //Student ID
grade double   //Student grade
locked int   //0 means not locked, > 1 is a date to lock until
hidden int   //0 means not hidden, 1 hidden, > 1 is a date to hide until
feedback string   //Feedback from the grader
feedbackformat int   //The feedback format
usermodified int   //The ID of the last user to modify this student grade
str_grade string   //A string representation of the grade
str_feedback string   //A formatted string representation of the feedback from the grader
} 
)} 
)} 
<?xml version="1.0" encoding="UTF-8" ?>
<RESPONSE>
    <SINGLE>
        <KEY name="items">
            <MULTIPLE>
                <SINGLE>
                    <KEY name="activityid">
                        <VALUE>string</VALUE>
                    </KEY>
                    <KEY name="itemnumber">
                        <VALUE>int</VALUE>
                    </KEY>
                    <KEY name="scaleid">
                        <VALUE>int</VALUE>
                    </KEY>
                    <KEY name="name">
                        <VALUE>string</VALUE>
                    </KEY>
                    <KEY name="grademin">
                        <VALUE>double</VALUE>
                    </KEY>
                    <KEY name="grademax">
                        <VALUE>double</VALUE>
                    </KEY>
                    <KEY name="gradepass">
                        <VALUE>double</VALUE>
                    </KEY>
                    <KEY name="locked">
                        <VALUE>int</VALUE>
                    </KEY>
                    <KEY name="hidden">
                        <VALUE>int</VALUE>
                    </KEY>
                    <KEY name="grades">
                        <MULTIPLE>
                            <SINGLE>
                                <KEY name="userid">
                                    <VALUE>int</VALUE>
                                </KEY>
                                <KEY name="grade">
                                    <VALUE>double</VALUE>
                                </KEY>
                                <KEY name="locked">
                                    <VALUE>int</VALUE>
                                </KEY>
                                <KEY name="hidden">
                                    <VALUE>int</VALUE>
                                </KEY>
                                <KEY name="overridden">
                                    <VALUE>int</VALUE>
                                </KEY>
                                <KEY name="feedback">
                                    <VALUE>string</VALUE>
                                </KEY>
                                <KEY name="feedbackformat">
                                    <VALUE>int</VALUE>
                                </KEY>
                                <KEY name="usermodified">
                                    <VALUE>int</VALUE>
                                </KEY>
                                <KEY name="datesubmitted">
                                    <VALUE>int</VALUE>
                                </KEY>
                                <KEY name="dategraded">
                                    <VALUE>int</VALUE>
                                </KEY>
                                <KEY name="str_grade">
                                    <VALUE>string</VALUE>
                                </KEY>
                                <KEY name="str_long_grade">
                                    <VALUE>string</VALUE>
                                </KEY>
                                <KEY name="str_feedback">
                                    <VALUE>string</VALUE>
                                </KEY>
                            </SINGLE>
                        </MULTIPLE>
                    </KEY>
                </SINGLE>
            </MULTIPLE>
        </KEY>
        <KEY name="outcomes">
            <MULTIPLE>
                <SINGLE>
                    <KEY name="activityid">
                        <VALUE>string</VALUE>
                    </KEY>
                    <KEY name="itemnumber">
                        <VALUE>int</VALUE>
                    </KEY>
                    <KEY name="scaleid">
                        <VALUE>int</VALUE>
                    </KEY>
                    <KEY name="name">
                        <VALUE>string</VALUE>
                    </KEY>
                    <KEY name="locked">
                        <VALUE>int</VALUE>
                    </KEY>
                    <KEY name="hidden">
                        <VALUE>int</VALUE>
                    </KEY>
                    <KEY name="grades">
                        <MULTIPLE>
                            <SINGLE>
                                <KEY name="userid">
                                    <VALUE>int</VALUE>
                                </KEY>
                                <KEY name="grade">
                                    <VALUE>double</VALUE>
                                </KEY>
                                <KEY name="locked">
                                    <VALUE>int</VALUE>
                                </KEY>
                                <KEY name="hidden">
                                    <VALUE>int</VALUE>
                                </KEY>
                                <KEY name="feedback">
                                    <VALUE>string</VALUE>
                                </KEY>
                                <KEY name="feedbackformat">
                                    <VALUE>int</VALUE>
                                </KEY>
                                <KEY name="usermodified">
                                    <VALUE>int</VALUE>
                                </KEY>
                                <KEY name="str_grade">
                                    <VALUE>string</VALUE>
                                </KEY>
                                <KEY name="str_feedback">
                                    <VALUE>string</VALUE>
                                </KEY>
                            </SINGLE>
                        </MULTIPLE>
                    </KEY>
                </SINGLE>
            </MULTIPLE>
        </KEY>
    </SINGLE>
</RESPONSE>
<?xml version="1.0" encoding="UTF-8"?>
<EXCEPTION class="invalid_parameter_exception">
    <MESSAGE>Invalid parameter value detected</MESSAGE>
    <DEBUGINFO></DEBUGINFO>
</EXCEPTION>

local_wsfunc_get_lastaccess

Get the last access time for a specified user.

Parameters
userid (Default to “0”)
User ID to check the last access of.
General structure

int  Default to "0" //User ID to check last access.

The last access time is returned as an integer representing a Unix timestamp. You may want to convert the timestamp to a localized date format before viewing.

General structure

object {
lastaccess int   //Last access time
} 
<?xml version="1.0" encoding="UTF-8" ?>
<RESPONSE>
    <SINGLE>
        <KEY name="lastaccess">
            <VALUE>int</VALUE>
        </KEY>
    </SINGLE>
</RESPONSE>
<?xml version="1.0" encoding="UTF-8"?>
<EXCEPTION class="invalid_parameter_exception">
    <MESSAGE>Invalid parameter value detected</MESSAGE>
    <DEBUGINFO></DEBUGINFO>
</EXCEPTION>

local_wsfunc_get_users_courses

Get list of courses user is enrolled in (only active enrolments are returned).

Parameters
userid (Required)
userid
General structure

int   //user id
General structure

list of ( 
object {
id int   //id of course
shortname string   //short name of course
fullname string   //long name of course
enrolledusercount int   //Number of enrolled users in this course
idnumber string   //id number of course
visible int   //1 means visible, 0 means hidden course
summary string  Optional //summary
summaryformat int  Optional //summary format (1 = HTML, 0 = MOODLE, 2 = PLAIN or 4 = MARKDOWN)
format string  Optional //course format: weeks, topics, social, site
showgrades int  Optional //true if grades are shown, otherwise false
lang string  Optional //forced course language
enablecompletion int  Optional //true if completion is enabled, otherwise false
enroltimestart int  Optional //time active enrolment began
enroltimeend int  Optional //time of active enrolment end
enroltimecreated int  Optional //time the enrolment record was created
} 
)
<?xml version="1.0" encoding="UTF-8" ?>
<RESPONSE>
    <MULTIPLE>
        <SINGLE>
            <KEY name="id">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="shortname">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="fullname">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="enrolledusercount">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="idnumber">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="visible">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="summary">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="summaryformat">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="format">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="showgrades">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="lang">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="enablecompletion">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="enroltimestart">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="enroltimeend">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="enroltimecreated">
                <VALUE>int</VALUE>
            </KEY>
        </SINGLE>
    </MULTIPLE>
</RESPONSE>
<?xml version="1.0" encoding="UTF-8"?>
<EXCEPTION class="invalid_parameter_exception">
    <MESSAGE>Invalid parameter value detected</MESSAGE>
    <DEBUGINFO></DEBUGINFO>
</EXCEPTION>

local_wsfunc_get_visible_courses

Return courses visible to a user.

Parameters
cat (Default to “0”)
Category ID: Get visible courses in the category. (Note: This is recursive and will get courses in sub-categories)
General structure

int  Default to "0" //Category ID: Get visible courses in the category. (Note: This is recursive and will get courses in sub-categories)

This function returns a list of courses that can be taken by students and corresponding course information such as course id number, the fullname of the course, and a course summary.

All courses fall under the ‘0’ category, so it is ok to leave the value of the cat parameter as the default to see all courses.

General structure

object {
courses list of ( 
  //information about one course
object {
id int   //course id
category int   //category id
shortname string   //course shortname
fullname string   //course fullname
startdate string  Optional //course startdate
summary string  Optional //course summary
} 
)} 
<?xml version="1.0" encoding="UTF-8" ?>
<RESPONSE>
    <SINGLE>
        <KEY name="courses">
            <MULTIPLE>
                <SINGLE>
                    <KEY name="id">
                        <VALUE>int</VALUE>
                    </KEY>
                    <KEY name="category">
                        <VALUE>int</VALUE>
                    </KEY>
                    <KEY name="shortname">
                        <VALUE>string</VALUE>
                    </KEY>
                    <KEY name="fullname">
                        <VALUE>string</VALUE>
                    </KEY>
                    <KEY name="startdate">
                        <VALUE>string</VALUE>
                    </KEY>
                    <KEY name="summary">
                        <VALUE>string</VALUE>
                    </KEY>
                </SINGLE>
            </MULTIPLE>
        </KEY>
    </SINGLE>
</RESPONSE>
<?xml version="1.0" encoding="UTF-8"?>
<EXCEPTION class="invalid_parameter_exception">
    <MESSAGE>Invalid parameter value detected</MESSAGE>
    <DEBUGINFO></DEBUGINFO>
</EXCEPTION>

local_wsfunc_programpartner_get_users

Get a list of users assigned to the ProgramPartner's cohorts.


No parameters are necessary for this function.

General structure

list of ( 
object {
id int   //ID of the user
username string  Optional //The username
firstname string  Optional //The first name(s) of the user
lastname string  Optional //The family name of the user
fullname string   //The fullname of the user
email string  Optional //An email address - allow email as root@localhost
address string  Optional //Postal address
phone1 string  Optional //Phone 1
phone2 string  Optional //Phone 2
icq string  Optional //icq number
skype string  Optional //skype id
yahoo string  Optional //yahoo id
aim string  Optional //aim id
msn string  Optional //msn number
department string  Optional //department
institution string  Optional //institution
idnumber string  Optional //An arbitrary ID code number perhaps from the institution
interests string  Optional //user interests (separated by commas)
firstaccess int  Optional //first access to the site (0 if never)
lastaccess int  Optional //last access to the site (0 if never)
auth string  Optional //Auth plugins include manual, ldap, etc
suspended int  Optional //Suspend user account, either false to enable user login or true to disable it
confirmed int  Optional //Active user: 1 if confirmed, 0 otherwise
lang string  Optional //Language code such as "en", must exist on server
calendartype string  Optional //Calendar type such as "gregorian", must exist on server
theme string  Optional //Theme name such as "standard", must exist on server
timezone string  Optional //Timezone code such as Australia/Perth, or 99 for default
mailformat int  Optional //Mail format code is 0 for plain text, 1 for HTML etc
description string  Optional //User profile description
descriptionformat int  Optional //int format (1 = HTML, 0 = MOODLE, 2 = PLAIN or 4 = MARKDOWN)
city string  Optional //Home city of the user
url string  Optional //URL of the user
country string  Optional //Home country code of the user, such as AU or CZ
profileimageurlsmall string   //User image profile URL - small version
profileimageurl string   //User image profile URL - big version
customfields  Optional //User custom fields (also known as user profile fields)
list of ( 
object {
type string   //The type of the custom field - text field, checkbox...
value string   //The value of the custom field
name string   //The name of the custom field
shortname string   //The shortname of the custom field - to be able to build the field class in the code
} 
)preferences  Optional //Users preferences
list of ( 
object {
name string   //The name of the preferences
value string   //The value of the preference
} 
)} 
)

<?xml version="1.0" encoding="UTF-8" ?>
<RESPONSE>
    <MULTIPLE>
        <SINGLE>
            <KEY name="id">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="username">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="firstname">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="lastname">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="fullname">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="email">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="address">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="phone1">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="phone2">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="icq">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="skype">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="yahoo">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="aim">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="msn">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="department">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="institution">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="idnumber">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="interests">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="firstaccess">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="lastaccess">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="auth">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="suspended">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="confirmed">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="lang">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="calendartype">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="theme">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="timezone">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="mailformat">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="description">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="descriptionformat">
                <VALUE>int</VALUE>
            </KEY>
            <KEY name="city">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="url">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="country">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="profileimageurlsmall">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="profileimageurl">
                <VALUE>string</VALUE>
            </KEY>
            <KEY name="customfields">
                <MULTIPLE>
                    <SINGLE>
                        <KEY name="type">
                            <VALUE>string</VALUE>
                        </KEY>
                        <KEY name="value">
                            <VALUE>string</VALUE>
                        </KEY>
                        <KEY name="name">
                            <VALUE>string</VALUE>
                        </KEY>
                        <KEY name="shortname">
                            <VALUE>string</VALUE>
                        </KEY>
                    </SINGLE>
                </MULTIPLE>
            </KEY>
            <KEY name="preferences">
                <MULTIPLE>
                    <SINGLE>
                        <KEY name="name">
                            <VALUE>string</VALUE>
                        </KEY>
                        <KEY name="value">
                            <VALUE>string</VALUE>
                        </KEY>
                    </SINGLE>
                </MULTIPLE>
            </KEY>
        </SINGLE>
    </MULTIPLE>
</RESPONSE>
<?xml version="1.0" encoding="UTF-8"?>
<EXCEPTION class="invalid_parameter_exception">
    <MESSAGE>Invalid parameter value detected</MESSAGE>
    <DEBUGINFO></DEBUGINFO>
</EXCEPTION>