I am connecting external application (server) with Moodle through Web Services API.
/login/token.php
./webservice/rest/server.php
endpoint.In some cases I need to provide userid
, which I don't know, because /login/token.php
does not return it.
I searched through the Web Services api documentation and found core_session_time_remaining
function. Documentation says it returns userid
and timeremaining
properties:
object {
userid int //The current user id.
timeremaining int //The number of seconds remaining in this session.
}
The problem is, returned userid
is always 0
, irrelevant of what token
was used to call this function. Is it a bug in Moodle, or am I using it wrong? How can I get userid
?
did you ever tried using the core_webservice_get_site_info
wsfunction?
I use it and works fine.
According to the docs: "Return some site info / user info / list web service functions" API Doc