Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
ReadMe | 2011-02-15 | 3.5 kB | |
MoodleRest.zip | 2011-02-15 | 221.2 kB | |
MoodleRest.jar | 2011-02-15 | 64.8 kB | |
Totals: 3 Items | 289.6 kB | 0 |
V0.1.2 The authentication using a username/password pair has been updated. A thank you goes to César Martínez for spotting my error, missing out an "&" between the wsusername and wspassword parameters. This version has had a few additions to the methods used to access web service routines which would normally require an array of parameters, the conversion to an array being hidden inside wrapper methods. Also added an number of constants to enable code created using the library to be more readable. Javadoc has been added to the code, very basic at the moment nbut will be added in due course. No change in the exception handling. To Do Still the MoodleRestEnrol to test Improve exception handling Improve the Javadoc Implement file web services FYI I wrote this library to enable me, together with database enrolment and my "SIMS CommandReporter Java API" library to synchronize my users and classes in Moodle with those in SIMS. Teachers use meta links to enrol the students from the SIMS Moodle courses. It does not invalidate the support agreement with Capita. It's working well. 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