Info
Content

Web Service Responses in JSON Format


To get web service responses in JSON format (e.g. with the REST protocol), you can pass the query parameter moodlewsrestformat=json. The default convention with Moodle is return web service responses in XML format.

E.g. you might a URL that looks like this (broken into segments for clarity):

https://yourmoodle.com/webservice/rest/server.php?
wstoken=<token>
&wsfunction=core_webservice_get_site_info
&moodlewsrestformat=json

This one is calling the core_webservice_get_site_info function with a token, and specifying that the output format needs to be JSON.

No Comments
Back to top