15 YouTube views, likes subscribers in 10 minutes. Free!
Get Free YouTube Subscribers, Views and Likes

How to Create Web Services in Moodle

Follow
Moodler Arjun

In this video you are going to learn How Web Services Infrastructure Works in Moodle.
Web services enable other systems to login to Moodle Sites and perform certain operations.

To run the web service and make it works, you can visit the end point from the browser or via curl.
For example to call a function via REST protocol, we can use below endpoints:

1) Generating a Token for Web Service
http://yoursite/login/token.php?username=USERNAME&password=PASSWORD&service=SERVICESHORTNAME

URL : http://yoursite/login/token.php
username : xyz
password : abc
service : service123

2) Making an API Call
http://yoursite/webservice/rest/server.php?wstoken=7c335a5bd39a46cb2db589735d97774e&wsfunction=local_custom_service_update_courses_sections&moodlewsrestformat=json&courseids=14

URL : http://yoursite/webservice/rest/server.php
wstoken : 04e3a50c7c60b0ffdb175c45bdecd850
wsfunction : local_custom_service_update_courses_sections
moodlewsrestformat : json
PARAM1 : 123
PARAM2 : 557
PARAM3 : 777

Read more about moodle web services here :
https://docs.moodle.org/dev/Web_services

Read more about moodle by visiting :
https://docs.moodle.org/311/en/Main_page

Explore this sample plugin for making custom services :
https://github.com/arjunsingh0037/Cus...

I hope you gain something out of this video. Incase you got any queries, do comment the same in the comment box. Also please make sure to like this video and subscribe to my channel.
{ Moodle Arjun }: {    / @moodlerarjun   }

posted by lolamaarld