itamart / moodle-block_mhaairs

0 stars 5 forks source link

Web services adjustments and new services: get_user_info and validate_login #6

Closed itamart closed 8 years ago

itamart commented 9 years ago

block_mhaairs_action provides entry point to retrieve user info and validate login. These functions are effectively web services and can be wrapped as such. Two new services will be added:

This enhancement will also include the following:

itamart commented 9 years ago

Web service get_user_info

Adjustments

Web service usage

Sample request url

http://localhost/moodle/webservice/rest/server.php?wstoken=the-token-of-the-service-user&moodlewsrestformat=json&token=37626234393138633566383930303732633365356131643735653431646463353b7573657269643d333b74696d653d323031342d31322d33315432313a30333a34352b30303a3030&identitytype=internal

Sample result

'{"status":0,"user":{"id":3,"deleted":0,"suspended":0,"username":"johndoh","idnumber":"","firstname":"John","lastname":"Doh","email":"johndoh@email.me","timezone":"99"},"courses":[{"id":4,"category":1,"fullname":"Presets","shortname":"Presets","idnumber":"","visible":1,"rolename":"student"},{"id":3,"category":1,"fullname":"MGH","shortname":"MGH","idnumber":"mgh","visible":1,"rolename":"student"},{"id":2,"category":1,"fullname":"Calendar Countdown","shortname":"CC","idnumber":"","visible":1,"rolename":"instructor"},{"id":2,"category":1,"fullname":"Calendar Countdown","shortname":"CC","idnumber":"","visible":1,"rolename":"student"}],"message":""}'