user3083303
user3083303

Reputation: 11

Getting Moodle Data as JSON

I want to get all moodle data from courses to quizzes to streaming links all as JSON.

I followed the API documentation, got the token, but after that where and how to use this token?

For instance if I want to get the courses list, then how can I do that? If someone can share some example please.

Upvotes: 1

Views: 5834

Answers (2)

Luuk Verhoeven
Luuk Verhoeven

Reputation: 31

Step 1 : Activate webservices in moodle. Here are the steps : http://docs.moodle.org/dev/Creating_a_web_service_client

http://<your_domain>/webservice/rest/server.php?wstoken=<your_token>&wsfunction=<your_function_name>

To return the response as json you can add &moodlewsrestformat=json

http://<your_domain>/webservice/rest/server.php?wstoken=<your_token>&wsfunction=<your_function_name>&moodlewsrestformat=json

Upvotes: 3

iankit
iankit

Reputation: 9352

Step 1 : Activate webservices in moodle. Here are the steps : http://docs.moodle.org/dev/Creating_a_web_service_client

Step 2 : Read up the API documentation. This is available in Site administration->plugins->web services->API documentation. This is available only to admin users. Eg the task you want is get courses list, the correct API for this would be "core_course_get_courses". API documentation has details of all available functions.

Upvotes: 1

Related Questions