Akbar Ismail
Akbar Ismail

Reputation: 63

How to Interact With Moodle REST API

so i want to build mobile app with flutter like moodleApp, so that app just fetch api from the existing moodle web, then, does moodle provid API to be used freely? or any other way?

Upvotes: 5

Views: 17606

Answers (2)

Igor
Igor

Reputation: 1121

To enable Moodle as an API (here it calls Web-Services) and create endpoint to make external HTTP-requests you need to follow these steps:

  1. Enable Web-Services support /admin/settings.php?section=optionalsubsystems#admin-enablewebservices
  2. Enable REST protocol /admin/settings.php?section=webserviceprotocols
  3. Create your Web-Service /admin/webservice/service.php?id=0
  4. Create token for your WS /admin/webservice/tokens.php?action=create
  5. At Services list /admin/settings.php?section=externalservices add an external function to your WS (click Functions next to your WS). Here you can add core external functions, also it is possible to create an own ones with your plugin.
  6. Read docs how to create endpoint with token, function and protocol and pass needle params to it.

Plugin for Moodle Web-Services

Moodle API/Web-Service is a big issue with a lot of things, to control and easy manage it from one place there is a local plugin WSManager.

Upvotes: 1

Ray
Ray

Reputation: 414

Yes. Moodle provide API

https://docs.moodle.org/dev/Core_APIs

https://docs.moodle.org/dev/Web_service_API_functions

https://docs.moodle.org/dev/Creating_a_web_service_client

Example : https://example.com/moodle/webservice/rest/server.php?wstoken=...&wsfunction=...&moodlewsrestformat=json

Upvotes: 9

Related Questions