moodle-web-service-client
Package to format service request in Moodle web service format
Table of Contents
Installation
This is a Node.js module available through the npm registry.
Before installing, download and install Node.js.
If this is a brand new project, make sure to create a package.json
first with
the npm init
command.
Installation is done using the
npm install
command:
$ npm install moodle-web-service-client
Debug errors Information
To activate debug options.
Go to moodle -> site administration -> developer -> debugging
In debugging messages select developer options.
Examples
General Use
If you want to use the default method (POST) you can use the following example.
import {moodleClient} from "moodle-web-service-client";
const response = await moodleClient({
urlRequest: {
rootURL: 'http://localhost/moodle',
token: 'aeb315e6dd3affc18352fe46124cdd48',
webServiceFunction: 'core_course_get_courses',
},
content: {
options: {
ids: [1, 2, 3],
},
},
});
General Use with another methods
If you want to use another methods like POST, PUT, DELETE, PATCH, etc. You can use the method property.
import {moodleClient} from "moodle-web-service-client";
const response = await moodleClient({
urlRequest: {
rootURL: 'http://localhost/moodle',
token: 'aeb315e6dd3affc18352fe46124cdd48',
webServiceFunction: 'core_course_get_courses',
},
content: {
options: {
ids: [1, 2, 3],
},
},
method: 'GET',
});
Docs
Issues
Looking to contribute? Look for the label.
🐛 Bugs
Please file an issue for bugs, missing documentation, or unexpected behavior.
💡 Feature Requests
Please file an issue to suggest new features. Vote on feature requests by adding a 👍. This helps maintainers prioritize what to work on.
Contributors
Hector L. Arrechea 💻 📖 🚇 |