Quantcast
Channel: Web services
Viewing all articles
Browse latest Browse all 2363

Getting user image (picture) from web services

$
0
0
by Luca Viggiani.  

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.



Viewing all articles
Browse latest Browse all 2363

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>