WebService API to upload file to a course?

WebService API to upload file to a course?

by Alan Snyder -
Number of replies: 4
I work for Tidebreak, which sells software for allow students and teachers to work simultaneously on the same computer. One of our products keeps an archive of all the documents/notes/web-links shared during a classroom session and then archives it as a zip file.

We would like to integrate with the CMS products out there like Moodle to make it easy for the teacher of this class to POST file classroom archive to the Moodle course web-page.

Our product is written in Java, so a WebService could be the best way, but if necessary we would write a POST command. I'm looking for advice here on the best way to proceed. From what I read on the site today Moodle 1.9 doesn't have WebServices, but it is part of the plan for 2.0. You do seem to have a Moodle Network XML-RPC mechanism but from the little I've read it might be limited. If we need to write a raw POST command to upload the file, we could do that.

What would be the recommended way for a 3rd party to upload a zip file to be posted on a Moodle course?

Alan
Average of ratings: -
In reply to Alan Snyder

Re: WebService API to upload file to a course?

by Alan Snyder -

I've been looking some more at the Moodle documentation today. It seems like an XML-RPC request is an option, but I need to confirm if it can do the following.

a) send login credentials for a teacher and a specific course.

b) When the class if finished send a URL to Moodle indicating the classroom

archive file to be uploaded.

c) Has Moodle upload the file and post it to a specific class.


Below is rather vauge, so I'm hoping someone can elaborate more on what

each of the four bullet points are.

-----------------

What can Moodle's XML-RPC do?

By default, we've strictly limited the functions that can be remotely called. These fall into four categories:

  • special 'system' functions
  • methods of an authorisation object
  • methods of an enrolment object
  • functions in a module
In reply to Alan Snyder

Re: WebService API to upload file to a course?

by Paul Charsley -

Hi Alan,

Have a look at the Lightwork project (http://moodle.org/mod/data/view.php?d=13&rid=2743) and http://lightwork.massey.ac.nz where all our code is freely available. We use the OKTech NUSoap web services in Moodle 1.9.x. Our web services do the following:

  • login to Moodle
  • get courses and assignments
  • upload and download files to Moodle
  • Update Moodle and our own tables
In reply to Alan Snyder

Re: WebService API to upload file to a course?

by Hubert Chathi -
Moodle 1.9 does not support plain XML-RPC. It only uses XML-RPC as a part of Moodle Networks, which adds encryption features on top of XML-RPC, and is not directly compatible with a plain XML-RPC implementation.

You may want to look into OKTech Web Services, which is available in contrib. However, you may still need to implement the functions you want, if it doesn't support those functions out of the box.
In reply to Hubert Chathi

Re: WebService API to upload file to a course?

by Sumit Negi -

Hi All,

Can anyone help me, how file can be uploaded using core_files_upload, I am not able to use it. I have integrated my moodle (2.4) with drupal and want to trigger file uploading from drupal to moodle but don't know how to use it.

Thanks

Sumit