After a lot of research, I come to you with this simple (I thought) question. How to modify an existing section programmatically (description among others) in php or shell through moodle's API?
I've succeeded to edit a section name by calling a Moodle's web service core_update_inplace_editable.
I tried to change the itemtype to target the "sectionsummary" (or "summary" or "sectiondescription") but it didn't work.
Without a proper documentation for the values it is just guess work...
Would someone know how to do that?
Can Moosh be of any help?
I've came across a plugin that claims to add web services functions: https://moodle.org/plugins/webservice_restful.
I'm reluctant to use it for two reasons.
As it's not part of the core, I don't know if it will be maintained in the future. And it may bring new vulnerabilities.
Have you used it?
Thanks in advance for your help!
Cheers,
Patrice
--------
Here is an example of a shell script using Curl to do edit a section name.
func="core_update_inplace_editable"
params="component=format_topics" # for courses in "topics" format
params="$params&itemtype=sectionname"
params="$params&itemid=3" # the section id returned by the core_course_get_contents function
params="$params&value=NewValue"
curl "$srvUrl/webservice/rest/server.php?wstoken=$token&wsfunction=$func&$params&moodlewsrestformat=json"