File upload requires context... but how do you find it?

File upload requires context... but how do you find it?

by Howard Miller -
Number of replies: 1
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

In order to use the 'core_files_upload' web service one needs to supply the 'contextid' parameter. However, using web services how does one establish this value?

If, for example, I want to upload files to the file submissions area of an assignment. I will have the cmid of the assignment. Internally, I would call context_module::get_instance($cmid) to establish the contextid but I can't do this using web services. 

Am I missing something or does this just need a tracker request for a new service to plug this gap?

Average of ratings: -
In reply to Howard Miller

Re: File upload requires context... but how do you find it?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Answering my own question...

What I completely missed was that 'null' can be supplied for contextid and then you supply 'contextlevel' and 'instanceid' as the final two parameters. 

Average of ratings: Useful (1)