Download Latest Version MoodleRest.jar (185.5 kB)
Email in envelope

Get an email when there's a new version of MoodleRest Java Library

Home / V0.1.1
Name Modified Size InfoDownloads / Week
Parent folder
ReadMe 2011-01-20 2.4 kB
MoodleRest.zip 2011-01-20 80.7 kB
MoodleRest.jar 2011-01-20 62.6 kB
Totals: 3 Items   145.8 kB 0
V0.1.1

Currently supports all web services except File services. User services are
limited to the main fields, extentions to the User data is ignored.

The MoodleRest.jar is the currently compiled library and MoodleRest.zip
contains the current source code as a NetBeans project.

To use the library, initialise the library with:

MoodleRestWebService.init(url,token);

Replacing <url> with your URL and path to your /webservice/rest/server.php eg.
"http://mymoodleserver.com/moodle/webservice/rest/server.php" and <token> with
your generated token which has the required rights.

There are Exceptions to catch but the code for retrieving all courses is:

MoodleCourse[] courses=MoodleRestCourse.getAllCourses();

More documentation will follow in due course, this is just a taster.

Changes:

Fixes:
*Create Group method fixed.
*int changed to long where appropriate within method calls.

Updates:
*JavaDoc started.
*username/password authentication routines functional but not tested fully.
 When tested gave an authentication error from the server. This could be
 due to my web services set up but should, logically, functional.
*A number of methods added to enable single calls rather than having to
 create arrays of objects only to populate with one for parameter calls.

All methods which do not call a web service are functional.

Tested and functional web service method calls:
*Class MoodleRestCourse
 createCourse
 CreateCourses
 getAllCourses
 getCourseFromId
 getCoursesById
*Class MoodleRestEnrol
 getEnrolledUsers
*Class MoodleRestGroup
 addMemberToGroup
 addMembersToGroups
 createGroup
 createGroups
 deleteGroup
 deleteGroups
 getGroupById
 getGroupsById
 getGroupsFromCourseId
*Class MoodleRestUser
 createUser
 createUsers
 deleteUsers
 deleteUsers
 getUserById
 getUsersById
 updateUser
 updateUsers
*Class MoodleRestWebService
 call

Tested but insufficient evidence of function:
* Class MoodleRestEnrol
 enrolUser
 enrolUsers
 *Both these methods did not return errors when called
  but... nothing seemed to happen in the database and
  the user was not enrolled on the course. Currently
  had to get the relevent "contextid" by looking in the database
  directly.

All other web service methods remain untested but are logically sound,
unless there is evidence to the opposite.

ToDo:

Test the remaining web service methods
Create MoodleRestFile web services Class
Continue documentation
Improve exception handling
Source: ReadMe, updated 2011-01-20