Moodle

File functions

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: Web Services
  • Labels:
    None

Description

Create web services for moodle files, so third party tools can access moodle files by moodle web services API.

Activity

Hide
Dongsheng Cai added a comment -

When developing files web services, I have got some ideas of web services:

1. Develope pre-defined services sets, so the administrator can click one button, then enabled all files web services.
2. Code generator, it is a bit hard to define the parameters and return value for complicated data structure, we'd better to generate parameters and return values from PHP data structure, we can ignore the data type (int, string etc) during this process, leave this for manual change, this is optional
3. Add a core service to return all active services on moodle, and a service to vefiry user account
4. We'd better to have json format protocal, for Javascript, xml is hard to parse, this will limit the use of moodle web services.

Show
Dongsheng Cai added a comment - When developing files web services, I have got some ideas of web services: 1. Develope pre-defined services sets, so the administrator can click one button, then enabled all files web services. 2. Code generator, it is a bit hard to define the parameters and return value for complicated data structure, we'd better to generate parameters and return values from PHP data structure, we can ignore the data type (int, string etc) during this process, leave this for manual change, this is optional 3. Add a core service to return all active services on moodle, and a service to vefiry user account 4. We'd better to have json format protocal, for Javascript, xml is hard to parse, this will limit the use of moodle web services.
Hide
Dongsheng Cai added a comment -

We could encode a binary file to a base64 string, then include it in xmlrpc/soap/rest request (that's what mnet did), but I don't think it is friendly to large files, another potential problem is, if some one develops a binary based prototol for moodle (such as google protocol buffers), then we need another solution to upload files.

So I am thinking it will be better if we upload a file in two steps:
1. Uses cURL (or others) to upload files to draft areas, return file information (an object including filepath, filename, itemid etc)
2. Pass the file info to web services to move/rename uploaded files.

In this case, we need a script to upload files (like what repository upload plugin do).

Show
Dongsheng Cai added a comment - We could encode a binary file to a base64 string, then include it in xmlrpc/soap/rest request (that's what mnet did), but I don't think it is friendly to large files, another potential problem is, if some one develops a binary based prototol for moodle (such as google protocol buffers), then we need another solution to upload files. So I am thinking it will be better if we upload a file in two steps: 1. Uses cURL (or others) to upload files to draft areas, return file information (an object including filepath, filename, itemid etc) 2. Pass the file info to web services to move/rename uploaded files. In this case, we need a script to upload files (like what repository upload plugin do).
Hide
Dongsheng Cai added a comment -

first patch to browse files and upload files to moodle.

Show
Dongsheng Cai added a comment - first patch to browse files and upload files to moodle.
Hide
Dongsheng Cai added a comment -

a xmlrpc client for testing.

Show
Dongsheng Cai added a comment - a xmlrpc client for testing.
Hide
Dongsheng Cai added a comment -

Note, I use base64 encode binary files in order to upload by xmlrpc, this could consume a lot of memory to process large files.

Show
Dongsheng Cai added a comment - Note, I use base64 encode binary files in order to upload by xmlrpc, this could consume a lot of memory to process large files.
Hide
Lailatul Hidayah added a comment -

It is very nice to see that it is resolved. I would like to try this. The problem is that I don't know where to start. I am new to xml rpc.I have downloaded the attachment files. I understand that they are for client and server but I have no clue how to implement them, Could you please give me a step by step procedure to apply this? Thank you for any help.

Show
Lailatul Hidayah added a comment - It is very nice to see that it is resolved. I would like to try this. The problem is that I don't know where to start. I am new to xml rpc.I have downloaded the attachment files. I understand that they are for client and server but I have no clue how to implement them, Could you please give me a step by step procedure to apply this? Thank you for any help.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: