More API Methods ?

More API Methods ?

by John Bailey -
Number of replies: 5

Hi,

I'm trying to use Moodle for my students that will take SCORM and SCORM 2004 courses. I have 4 methods that I need to implement from my application to comunicate with Moodle :

RegisterUserForLMSCourse - moodle_enrol_manual_enrol_users
CreateLMSUserFromStudent - moodle_user_create_users
GetCourseCompletionStatus - ??? /*somethign to know if the course is incomplete, failed, complete, score ... etc */
RemoveLMSStudentCourse - ??? /* the oposite of enroll */

Now, above is what I found and thought I could use, but what about the other 2 methods ? Their name is descriptive I think.

Thank you.

Average of ratings: -
In reply to John Bailey

Re: More API Methods ?

by Tony Hatfield -

john,

i'm not sure about existing functions in the api, so someone else might be better suited to tell you if these sorts of things exist.

having said that, know that if it doesnt exist, the api's capability can be extended by a programmer to access any function that moodle uses internally. to do this though, demands a bit of experience, and it should be tested before rolling it out. 

 

hope that gets you started.

 

cheers,

 

ray

In reply to Tony Hatfield

Re: More API Methods ?

by silvia bastos -

Dear John,

The funcitons available for each module are described here.

/server/moodle/lib/db/services.php

Also you can see this services if you go to Site "Administration->plugins->Web services->External services->Add" and add a test Web service, then "Add functions" and you can see all available web services functions.

 

Best regards, Silvia

In reply to silvia bastos

Re: More API Methods ?

by John Bailey -

Well.. I don't need to find the list, as I said in my original post I already identified 2 functions that are helpfull, but I'm asking about the other 2 functions .. what can I map them to ?

In reply to Tony Hatfield

Re: More API Methods ?

by John Bailey -

Can you point me to some documentation about how I could do that ?

In reply to John Bailey

Re: More API Methods ?

by silvia bastos -

Dear John,

You can find some information at:

http://docs.moodle.org/dev/Creating_a_web_service_and_a_web_service_function

This is the one I use when I started, but, It was hard to me, and take me some hours to make a simple function to work.

Summarizing:

First you must add your function to /lib/db/services.php

Then you must add this function to the externallib.php file (I do it inside scorm/externallib.php but I guess exist somehow to make it in a independent way)

You must create the functions for:

  • Parameters
  • Returns
  • Function itself

At the end (and this is important and I think the link don't explain it) you should update your moodle version at moodle/version.php and mod/scorm/version.php and click to notifications.

This is the method I use.

Silvia.

Average of ratings: Useful (1)