Hi, I'm evaluating the ways to edit contents of courses via Web Services APIs (I'm on MoodleCloud, so PHP API use is restricted) . I'm struggling to figure out the right endpoints.
So far on my instance I found out about `core_courseformat_update_course` and related endpoints, but the docs have no information on how to update particular section/activity, what's the right payload structure, etc.
The purpose is to be able to partially automate large number of edits of content which we'd be doing outside the Moodle editor.
Is there a place where I can find the documentation for data structures used to edit particular activities/sections, like HTML Area, or some h5p activity?
Screenshot below shows the.. minimal explanation stating that it's just "update course contents" but doesn't link to any resource which says what data to pass. I don't even see a field where data would go...
Can someone point me in the right direction?
Details on how to add or edit an activity via web services APIs
by Jakub Petrykowski -
Number of replies: 2
In reply to Jakub Petrykowski
Details on how to add or edit an activity via web services APIs
by Davo Smith -
Off the top of my head, I don't think that Moodle provides an API for what you want to do.
The API function you mention is for doing general changes - e.g. hide/show activity or section, move activity or section, etc. not for detailed changes, like updating the content of a label (the only webservice functions provided by labels are to get a list of labels within a given set of courses).
The API function you mention is for doing general changes - e.g. hide/show activity or section, move activity or section, etc. not for detailed changes, like updating the content of a label (the only webservice functions provided by labels are to get a list of labels within a given set of courses).
In reply to Davo Smith
Details on how to add or edit an activity via web services APIs
by Jakub Petrykowski -
Hmm. OK, that's .. sad, but understandable that not all possible APIs are there.
Although - the activity visibility and other parameters- the things you mention- they aren't documented here either, so how would someone know what payload to pass?
On more general terms, can you think of any other way to programmatically update a course? Should I look into local Moodle instance > use PHP > save course > export > import on target Moodle instance? (I guess then I can use powerful local PHP developer APIs?) Is there something more straigthforward?
Although - the activity visibility and other parameters- the things you mention- they aren't documented here either, so how would someone know what payload to pass?
On more general terms, can you think of any other way to programmatically update a course? Should I look into local Moodle instance > use PHP > save course > export > import on target Moodle instance? (I guess then I can use powerful local PHP developer APIs?) Is there something more straigthforward?