LMSouq
moodle-core Open

Moodle: get user picture from webservice

LV
lviggiani
1 month ago
3 views
Problem Description
By using Moodle Web Service (REST) call `core_user_get_users_by_field` I successfully get my user details. One of the returned fields is `profileimageurl` that links to my user profile picture and look like this: http://my_moodle_server/pluginfile.php/89/user/icon/f1 Unfortunately that link works only in a browser where I have already logged in, otherwise it will redirect to a standard user icon (the grey anonymous face). So in order to get the actual picture form a client app that is using moodle web services I think I have to call `core_files_get_files` and pass correct values. So I tried to remap that link to calls paramenters like this: contextid: 89 component: "user" filearea: "icon" itemid: 0 filepath: "/" filename: "f1.png" (also tryed without .png) and of course my valid token but all I get is: {"parents":[],"files":[]} Parameters seem to be formally correct (otherwise I would get an exception) however I only get empty response which tells me that some values are not correct.

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base