bofanda
bofanda

Reputation: 11806

Getting all calendar events in moodle using Web Services API

after the upgrade of my moodle to 2.5dev version I'm trying to get calendar events using core_calendar_get_calendar_events function in url:

http://localhost/moodle-2.5dev/webservice/rest/server.php?wstoken=token_here&wsfunction=core_calendar_get_calendar_events

The result is just an empty xml file with the elements KEY name="events" and KEY name="warnings". From Documents API I got that it needs to required parameter events, but have no idea how to use it, since the function is new itself. Any help would be appreciated.

Upvotes: 1

Views: 1753

Answers (1)

Joseph Cape
Joseph Cape

Reputation: 403

You want to be looking in ROOT/calendar/externallib.php - which might be more accurately called the component's web service library. Look for the function get_calendar_events_parameters: This tells you that the function expects two arguments. The first argument, 'events', is an array with 'eventids' containing an array of ids; likewise 'courseids' and 'groupids'.

The second argument is 'options' which is an array containing 'userevents' (bool), 'siteevents' (bool), 'timestart' (int), 'timeend' (int) & 'ignorehidden' (bool).

So the function call should be something like:

$soap->core_calendar_get_calendar_events(array(array(1),array(2),array(3)), array(true, true, 0, 0, true));

Upvotes: 0

Related Questions