API Documentation

API Documentation

by Graham Stott -
Number of replies: 3

Hi,

I'm currently in the process of evaluating Moodle for a client. I'd like more information about the full API but according to your documentation:

The full API can be found on any Moodle sites under Administration block > Plugins > Web services > API Documentation

Is it possible to have access to this some other way as we don't have an installation yet?

Thanks.


Average of ratings: -
In reply to Graham Stott

Re: API Documentation

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

I am afraid you are actually asking a wrong question.

There is nothing like "Moodle API" as you might expect from some other smaller systems. In each Moodle installation, the admin defines which of so called external functions are to be exposed via which protocols (REST, SOAP, ...). The functions are organised into logical groups called web service. Each web service provides only those functions that are needed for the provided functionality.

So the logic is reversed - first you specify the other system's requirements, and then the API is made to fulfil those requirements.

In reply to David Mudrák

Re: API Documentation

by Graham Stott -
Ok, thanks David. That sounds pretty comprehensive. Just to check my understanding of a couple of the APIs, if we wanted to create a new user in Moodle and enrol them on a course in response to them buying a course on an eCommerce platform, I presume we'd call the core_user_create_users function and then using the returned user_id we'd then call enrol_manual_enrol_users with the relevant course_id and role_id (which would be stored against the related course product in the eCommerce platform)?

Thanks.