How to get userid from username

How to get userid from username

by Json Chau -
Number of replies: 2

I would like to call core_user_get_users_by_id service

And here is my url, it works

My problem is userids

I know it as 2 on the website, but how can i get it from my username in client by call any service.

Please helps me.

Thanks in advance

Average of ratings: -
In reply to Json Chau

Re: How to get userid from username

by Oliver Obermayr -

I would recommend you to use first core_webservice_get_site_info, this function will give you except all information about the moodle site user info as well (including user id), then you can use those data in your url:


http://localhost/webservice/rest/server.php?wstoken=28953b51167c5fbc30b3333ac2d2ff55&wsfunction=core_user_get_users_by_id

I've used php for realizing of above mentioned activities. Hope this will help you. Cheers

Average of ratings: Useful (1)