How to change user image in moodle with REST api

2.2k views Asked by At

I am using Moodle 2.7.4.

I am writing a web application that uses moodle REST APIs. But I couldn't find an API to change User profile picture.

Can anybody tell me what the API is and its docs.

PS: I know we can upload file with /webservice/upload.php
This API is returning the itemid after uploading the file.
Even after updating this itemid to mdl_user tables picture column, it is not displaying the image.
It is not displaying image even after I update the id of mdl_files column for this itemid, to mdl_user table.
For this call, My filearea is draft (When I set as icon, it is throwing 500 error)

1

There are 1 answers

0
Akshay Kumbhar On

There i not single API for this function but you may use "core_files_upload" to upload files and then use "core_user_update_picture" function for change the user profile picture image. plz find this function in API documentation then you ill get an idea.